namespace FanG
{
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Drawing.Imaging;
    using System.Drawing.Text;
    using System.IO;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    [ToolboxBitmap("FanG.ico")]
    public class Chartlet : WebControl
    {
        private byte _Alpha3D = 0xff;
        private AppearanceStyles _AppearanceStyle = AppearanceStyles.Bar_2D_Aurora_FlatCrystal_Glow_NoBorder;
        private bool _AutoBarWidth = true;
        private BackgroundAttributes _Background;
        private double _BaseLineX = -0.830213;
        private TextAttributes _ChartTitle;
        private ChartTypes _ChartType;
        private string _ClientClick = "";
        private string _ClientMouseMove = "";
        private string _ClientMouseOut = "";
        private string _ClientMouseOver = "";
        private string _ClientUseMap = "";
        private bool _Colorful = true;
        private Attributes _ColorGuider;
        private string _CopyrightText = "Provided by Chartlet.cn";
        private CrystalAttributes _Crystal;
        private int _Depth3D = 10;
        private ChartDimensions _Dimension;
        private Painting _Fill;
        private int _ImageBorder;
        private string _ImageFolder = "Chartlet";
        private string _ImageStyle = "";
        private int _InflateBottom;
        private int _InflateLeft;
        private int _InflateRight;
        private int _InflateTop;
        private int _LineConnectionRadius = 10;
        private LineConnectionTypes _LineConnectionType;
        private double _MaxValueY;
        private double _MinValueY;
        private int _MutipleBars;
        private ImageFormat _OutputFormat = ImageFormat.Jpeg;
        private string _RootPath = @"C:\";
        private int _RoundRadius = 2;
        private bool _RoundRectangle;
        private ShadowAttributes _Shadow;
        private bool _ShowCopyright;
        private bool _ShowErrorInfo = true;
        private StrokeStyle _Stroke;
        private Attributes _Tips;
        private XLabelsAttributes _XLabels;
        private LabelsAttributes _YLabels;
        public Color[] Aurora = new Color[] { Color.FromArgb(0xff, 0x19, 0xca, 0x2d), Color.FromArgb(0xff, 0xf4, 0x20, 0x20), Color.FromArgb(0xff, 0x25, 0x20, 0xf2), Color.FromArgb(0xff, 240, 0x20, 0xf2), Color.FromArgb(0xff, 240, 0xf2, 0x20), Color.FromArgb(0xff, 0x20, 0xf2, 0xeb), Color.FromArgb(0xff, 0xf2, 0x97, 0x20), Color.FromArgb(0xff, 0x92, 0xf2, 0x20), Color.FromArgb(0xff, 0x92, 0x20, 0xf2), Color.FromArgb(0xff, 0x20, 0x83, 0xf2), Color.FromArgb(0xff, 0xf2, 0x65, 0x20), Color.FromArgb(0xff, 0x16, 0x99, 0xf5) };
        public string[] AxisX;
        private Color[] BarBrushColor = new Color[] { Color.FromArgb(0xff, 0xd6, 0xa6, 0xe7), Color.FromArgb(0xff, 0x7f, 0xb8, 210), Color.FromArgb(0xff, 0xe7, 0xd8, 0xa6), Color.FromArgb(0xff, 180, 0xa6, 0xe7), Color.FromArgb(0xff, 0xb5, 0xe7, 0xa6), Color.FromArgb(0xff, 0xe7, 0xa6, 0xa6), Color.FromArgb(0xff, 180, 0xa6, 0xe7), Color.FromArgb(0xff, 0xc6, 0xe7, 0xa6), Color.FromArgb(0xff, 0xe7, 0xa6, 0xe2), Color.FromArgb(0xff, 0xcd, 0xb5, 0x9d), Color.FromArgb(0xff, 0x9d, 0xcd, 200), Color.FromArgb(0xff, 0xde, 0xde, 0xde) };
        private Color[] BarPenColor = new Color[] { Color.FromArgb(0xff, 120, 0x87, 0x88), Color.FromArgb(0xff, 120, 0x87, 0x88), Color.FromArgb(0xff, 120, 0x87, 0x88), Color.FromArgb(0xff, 120, 0x87, 0x88), Color.FromArgb(0xff, 120, 0x87, 0x88), Color.FromArgb(0xff, 120, 0x87, 0x88), Color.FromArgb(0xff, 120, 0x87, 0x88), Color.FromArgb(0xff, 120, 0x87, 0x88), Color.FromArgb(0xff, 120, 0x87, 0x88), Color.FromArgb(0xff, 120, 0x87, 0x88), Color.FromArgb(0xff, 120, 0x87, 0x88), Color.FromArgb(0xff, 120, 0x87, 0x88) };
        private float BaseLineXInt;
        public Color[] Breeze = new Color[] { Color.FromArgb(0xff, 0xd6, 0xa6, 0xe7), Color.FromArgb(0xff, 0x7f, 0xb8, 210), Color.FromArgb(0xff, 0xe7, 0xd8, 0xa6), Color.FromArgb(0xff, 180, 0xa6, 0xe7), Color.FromArgb(0xff, 0xb5, 0xe7, 0xa6), Color.FromArgb(0xff, 0xe7, 0xa6, 0xa6), Color.FromArgb(0xff, 180, 0xa6, 0xe7), Color.FromArgb(0xff, 0xc6, 0xe7, 0xa6), Color.FromArgb(0xff, 0xe7, 0xa6, 0xe2), Color.FromArgb(0xff, 0xcd, 0xb5, 0x9d), Color.FromArgb(0xff, 0x9d, 0xcd, 200), Color.FromArgb(0xff, 0xde, 0xde, 0xde) };
        private string ChartFileName = "Chartlet.Jpg";
        private bool DataBound;
        public string[] GroupTitle;
        private float[][] IntDatas;
        private int MaxCount;
        private float MaxData = 100f;
        private int MinCount;
        private float MinData;
        private decimal[][] RawDatas;
        public Color[] StarryNight = new Color[] { Color.FromArgb(0xff, 0x57, 14, 0x4e), Color.FromArgb(0xff, 0x57, 0x37, 14), Color.FromArgb(0xff, 14, 60, 0x57), Color.FromArgb(0xff, 0x57, 0x23, 14), Color.FromArgb(0xff, 0x29, 0x57, 14), Color.FromArgb(0xff, 60, 14, 0x57), Color.FromArgb(0xff, 0x57, 14, 14), Color.FromArgb(0xff, 0x2b, 14, 0x57), Color.FromArgb(0xff, 14, 0x56, 0x57), Color.FromArgb(0xff, 0x3e, 0x57, 14), Color.FromArgb(0xff, 0x3d, 3, 0x38), Color.FromArgb(0xff, 3, 0x21, 0x3d) };
        private string StrBarH = "";
        private string StrBarL = "";
        private string StrBarT = "";
        private string StrBarV = "";
        private string StrBarW = "";

        public Chartlet()
        {
            this.Width = 600;
            this.Height = 400;
            this.Breeze.CopyTo(this.BarBrushColor, 0);
            this.ChartTitle.Text = "FanG Chartlet";
            this.ChartTitle.Font = new Font("Arial", 16f, FontStyle.Bold, GraphicsUnit.Pixel);
            this.ChartTitle.ForeColor = Color.DarkBlue;
            this.XLabels.UnitText = "XLabelsUnit";
            this.YLabels.UnitText = "YLabelsUnit";
        }

        public void BindChartData(DataSet DataSource)
        {
            if (DataSource != null)
            {
                this.BindChartData(DataSource.Tables[0]);
                DataSource.Dispose();
            }
        }

        public void BindChartData(DataTable DataSource)
        {
            if (DataSource != null)
            {
                ArrayList[] chartData = new ArrayList[DataSource.Columns.Count - 1];
                ArrayList xLabel = new ArrayList();
                ArrayList colorGuider = new ArrayList();
                if (this.XLabels.UnitText == "XLabelsUnit")
                {
                    this.XLabels.UnitText = DataSource.Columns[0].ColumnName;
                }
                for (int i = 0; i < DataSource.Rows.Count; i++)
                {
                    xLabel.Add(DataSource.Rows[i][0].ToString());
                }
                for (int j = 0; j < (DataSource.Columns.Count - 1); j++)
                {
                    chartData[j] = new ArrayList();
                    for (int k = 0; k < DataSource.Rows.Count; k++)
                    {
                        chartData[j].Add(DataSource.Rows[k][j + 1].ToString());
                    }
                    colorGuider.Add(DataSource.Columns[j + 1].ColumnName);
                }
                this.InitializeData(chartData, xLabel, colorGuider);
                DataSource.Dispose();
            }
        }

        public void BindChartData(DataView DataSource)
        {
            if (DataSource != null)
            {
                ArrayList[] chartData = new ArrayList[DataSource.Table.Columns.Count - 1];
                ArrayList xLabel = new ArrayList();
                ArrayList colorGuider = new ArrayList();
                if (this.XLabels.UnitText == "XLabelsUnit")
                {
                    this.XLabels.UnitText = DataSource.Table.Columns[0].ColumnName;
                }
                for (int i = 0; i < DataSource.Table.Rows.Count; i++)
                {
                    xLabel.Add(DataSource[i][0].ToString());
                }
                for (int j = 0; j < (DataSource.Table.Columns.Count - 1); j++)
                {
                    chartData[j] = new ArrayList();
                    for (int k = 0; k < DataSource.Table.Rows.Count; k++)
                    {
                        chartData[j].Add(DataSource[k][j + 1].ToString());
                    }
                    colorGuider.Add(DataSource.Table.Columns[j + 1].ColumnName);
                }
                this.InitializeData(chartData, xLabel, colorGuider);
                DataSource.Dispose();
            }
        }

        public void BindChartData(SqlDataSource DataSource)
        {
            if (DataSource != null)
            {
                DataSourceSelectArguments arguments = new DataSourceSelectArguments();
                DataView dataSource = (DataView) DataSource.Select(arguments);
                this.BindChartData(dataSource);
                DataSource.Dispose();
            }
        }

        private void DrawAxisUnit(Graphics g, int ChartLeft, int ChartTop, int ChartW, int ChartH)
        {
            g.TextRenderingHint = TextRenderingHint.AntiAlias;
            if ((this.XLabels.UnitText != null) && this.XLabels.Show)
            {
                g.DrawString(this.XLabels.UnitText, this.XLabels.UnitFont, new SolidBrush(this.XLabels.ForeColor), (float) (ChartW + ChartLeft), (float) (ChartH + ChartTop));
            }
            if ((this.YLabels.UnitText != null) && this.YLabels.Show)
            {
                g.DrawString(this.YLabels.UnitText, this.YLabels.UnitFont, new SolidBrush(this.YLabels.ForeColor), 2f, (float) (ChartTop - 0x19));
            }
        }

        private void DrawBarBase2D(Graphics g, SolidBrush BarBrush, Pen BarPen, int BarLeft, int BarTop, int BarW, int BarH)
        {
            if (this.Shadow.Enable)
            {
                TextShadow shadow = new TextShadow();
                shadow.Radius = this.Shadow.Radius;
                shadow.Distance = this.Shadow.Distance;
                shadow.Alpha = this.Shadow.Alpha;
                shadow.Angle = this.Shadow.Angle;
                string action = "Fill";
                if (this.Shadow.Hollow)
                {
                    action = "Draw";
                }
                shadow.DropShadow(g, new Rectangle(BarLeft, BarTop, BarW, BarH), this.Shadow.Color, action, "Rectangle", null, 1);
            }
            if (this.RoundRectangle)
            {
                g.SmoothingMode = SmoothingMode.AntiAlias;
                if (this.RoundRadius < 1)
                {
                    this.RoundRadius = 1;
                }
                g.FillPath(BarBrush, this.GetRoundRect((float) BarLeft, (float) BarTop, (float) BarW, (float) BarH, (float) this.RoundRadius, true));
                if (this.Stroke.Width > 0)
                {
                    g.DrawPath(BarPen, this.GetRoundRect((float) BarLeft, (float) BarTop, (float) BarW, (float) BarH, (float) this.RoundRadius, true));
                }
                g.SmoothingMode = SmoothingMode.None;
            }
            else
            {
                g.FillRectangle(BarBrush, BarLeft, BarTop, BarW, BarH);
                if (this.Stroke.Width > 0)
                {
                    g.DrawRectangle(BarPen, BarLeft, BarTop, BarW, BarH);
                }
            }
        }

        private void DrawBarBase3D(Graphics g, SolidBrush BarBrush, Pen BarPen, int BarLeft, int BarTop, int BarW, int BarH, int Depth)
        {
            GraphicsPath path = new GraphicsPath();
            path.StartFigure();
            path.AddLine(BarLeft, BarTop, BarLeft - Depth, BarTop + Depth);
            path.AddLine((int) (BarLeft - Depth), (int) (BarTop + Depth), (int) ((BarLeft - Depth) + BarW), (int) (BarTop + Depth));
            path.AddLine((BarLeft - Depth) + BarW, BarTop + Depth, BarLeft + BarW, BarTop);
            path.AddLine(BarLeft + BarW, BarTop, BarLeft, BarTop);
            g.FillPath(BarBrush, path);
            g.FillPath(new SolidBrush(Color.FromArgb(20, Color.Black)), path);
            if (this.Stroke.Width > 0)
            {
                g.DrawPath(BarPen, path);
            }
            path.Reset();
            path.StartFigure();
            path.AddLine(BarLeft + BarW, BarTop, (BarLeft + BarW) - Depth, BarTop + Depth);
            path.AddLine((int) ((BarLeft + BarW) - Depth), (int) (BarTop + Depth), (int) ((BarLeft + BarW) - Depth), (int) ((BarTop + Depth) + BarH));
            path.AddLine((int) ((BarLeft + BarW) - Depth), (int) ((BarTop + Depth) + BarH), (int) (BarLeft + BarW), (int) (BarTop + BarH));
            path.AddLine(BarLeft + BarW, BarTop + BarH, BarLeft + BarW, BarTop);
            g.FillPath(BarBrush, path);
            g.FillPath(new SolidBrush(Color.FromArgb(40, Color.Black)), path);
            if (this.Stroke.Width > 0)
            {
                g.DrawPath(BarPen, path);
            }
            path.Reset();
            path.StartFigure();
            path.AddLine((int) (BarLeft - Depth), (int) (BarTop + Depth), (int) (BarLeft - Depth), (int) ((BarTop + Depth) + BarH));
            path.AddLine((int) (BarLeft - Depth), (int) ((BarTop + Depth) + BarH), (int) ((BarLeft - Depth) + BarW), (int) ((BarTop + Depth) + BarH));
            path.AddLine((int) ((BarLeft - Depth) + BarW), (int) ((BarTop + Depth) + BarH), (int) ((BarLeft - Depth) + BarW), (int) (BarTop + Depth));
            path.AddLine((int) ((BarLeft - Depth) + BarW), (int) (BarTop + Depth), (int) (BarLeft - Depth), (int) (BarTop + Depth));
            g.FillPath(BarBrush, path);
            if (this.Stroke.Width > 0)
            {
                g.DrawPath(BarPen, path);
            }
            path.Dispose();
        }

        private void DrawBarCrystal(Graphics g, int BarLeft, int BarTop, int BarW, int BarH, int Depth)
        {
            Point point;
            Point point2;
            Rectangle rectangle = new Rectangle(BarLeft - Depth, BarTop + Depth, BarW, BarH);
            rectangle.Inflate(-1 * this.Crystal.Contraction, -1 * this.Crystal.Contraction);
            if (!this.Crystal.CoverFull)
            {
                Rectangle rect = new Rectangle(BarLeft - Depth, BarTop + Depth, (BarW / 2) + 1, BarH);
                rectangle.Intersect(rect);
            }
            switch (this.Crystal.Direction)
            {
                case Direction.LeftRight:
                    point = new Point(rectangle.Left, 0);
                    point2 = new Point((rectangle.Left + rectangle.Width) + 1, 0);
                    break;

                case Direction.TopBottom:
                    point = new Point(0, rectangle.Top - 1);
                    point2 = new Point(0, rectangle.Top + rectangle.Height);
                    break;

                case Direction.RightLeft:
                    point = new Point(rectangle.Left + rectangle.Width, 0);
                    point2 = new Point(rectangle.Left - 1, 0);
                    break;

                case Direction.BottomTop:
                    point = new Point(0, rectangle.Top + rectangle.Height);
                    point2 = new Point(0, rectangle.Top - 1);
                    break;

                default:
                    point = new Point(rectangle.Left, 0);
                    point2 = new Point(rectangle.Left + (rectangle.Width / 2), 0);
                    break;
            }
            LinearGradientBrush brush = new LinearGradientBrush(point, point2, Color.FromArgb(0xb2, Color.White), Color.FromArgb(0x19, Color.White));
            if (this.RoundRectangle)
            {
                int num = this.RoundRadius - 2;
                if (num < 1)
                {
                    num = 1;
                }
                g.SmoothingMode = SmoothingMode.AntiAlias;
                g.FillPath(brush, this.GetRoundRect((float) rectangle.Left, (float) rectangle.Top, (float) rectangle.Width, (float) rectangle.Height, (float) num, "Full"));
                g.SmoothingMode = SmoothingMode.None;
            }
            else
            {
                g.FillRectangle(brush, rectangle.Left, rectangle.Top, rectangle.Width, rectangle.Height);
            }
            brush.Dispose();
        }

        private void DrawBarsChart()
        {
            int num7;
            int width = (int.Parse(this.Width.ToString().Substring(0, this.Width.ToString().Length - 2)) + this.InflateRight) + this.InflateLeft;
            int height = (int.Parse(this.Height.ToString().Substring(0, this.Height.ToString().Length - 2)) + this.InflateBottom) + this.InflateTop;
            Bitmap image = new Bitmap(width, height);
            Graphics g = Graphics.FromImage(image);
            int chartLeft = 50 + this.InflateLeft;
            int chartTop = 60 + this.InflateTop;
            int num5 = 100 + this.InflateRight;
            int num6 = 40 + this.InflateBottom;
            int chartW = (width - chartLeft) - num5;
            int chartH = (height - chartTop) - num6;
            if (!this.ColorGuider.Show)
            {
                chartW += 0x62 - ((int) g.MeasureString(this.XLabels.UnitText, this.XLabels.UnitFont).Width);
                num5 -= 0x62;
            }
            if (!this.YLabels.Show)
            {
                chartW += 0x30;
                chartLeft -= 0x30;
            }
            if (!this.ChartTitle.Show)
            {
                chartH += 0x21;
                chartTop -= 0x21;
            }
            if (!this.DataBound && this.ShowErrorInfo)
            {
                this.ChartTitle.Text = "Please bind a data source with BindChartData()!";
            }
            int depth = 0;
            if (this.Dimension == ChartDimensions.Chart3D)
            {
                depth = (int) (this.Depth3D * 0.85);
                this.PaintBackground3D(g, chartLeft, chartTop, chartW, chartH);
                num7 = this.Alpha3D;
            }
            else
            {
                this.PaintBackground(g, chartLeft, chartTop, chartW, chartH);
                num7 = 0xff;
            }
            if (this.DataBound)
            {
                g.TextRenderingHint = TextRenderingHint.AntiAlias;
                Pen backPen = new Pen(Color.FromArgb(0xff, 220, 220, 220));
                int groupSize = this.GroupSize;
                int maxCount = this.MaxCount;
                if (maxCount > 0)
                {
                    int num13;
                    int num14;
                    if (!this.AutoBarWidth && ((maxCount * groupSize) < 12))
                    {
                        num13 = (chartW / 4) / 0x10;
                        num14 = 5 * num13;
                    }
                    else
                    {
                        num14 = (int) (((double) (chartW / maxCount)) / (0.25 + groupSize));
                        num13 = (int) (0.25 * num14);
                    }
                    for (int i = 0; i < maxCount; i++)
                    {
                        int num15 = i;
                        int barLeft = (chartLeft + ((num14 * num15) * this.GroupSize)) + (num13 * (num15 + 1));
                        int num20 = (int) (((double) depth) / 0.85);
                        this.DrawXLine(g, backPen, num20, chartTop, chartH, barLeft + ((num14 * groupSize) / 2), (num14 * groupSize) + num13);
                        if (this.XLabels.Show && ((i % this.XLabels.SampleSize) == 0))
                        {
                            this.DrawXText(g, backPen, this.AxisX[i], num20, chartTop, chartH, barLeft + ((num14 * groupSize) / 2), (num14 * groupSize) + num13);
                        }
                        bool belowX = false;
                        for (int j = 0; j < groupSize; j++)
                        {
                            if (this.RawDatas[j][i] != -0.830213M)
                            {
                                int num17;
                                SolidBrush brush;
                                Pen pen2;
                                int barH = (int) ((this.IntDatas[j][i] - this.BaseLineXInt) - 1f);
                                if (barH < 0)
                                {
                                    barH = -1 * barH;
                                    num17 = (chartTop + chartH) - ((int) this.BaseLineXInt);
                                    belowX = true;
                                }
                                else
                                {
                                    num17 = ((chartTop + chartH) - barH) - ((int) this.BaseLineXInt);
                                    belowX = false;
                                }
                                if ((groupSize == 1) && this.Colorful)
                                {
                                    if (this.Dimension == ChartDimensions.Chart3D)
                                    {
                                        brush = new SolidBrush(Color.FromArgb(num7, this.BarBrushColor[i % 12]));
                                    }
                                    else
                                    {
                                        brush = new SolidBrush(this.BarBrushColor[i % 12]);
                                    }
                                }
                                else if (this.Dimension == ChartDimensions.Chart3D)
                                {
                                    brush = new SolidBrush(Color.FromArgb(num7, this.BarBrushColor[j % 12]));
                                }
                                else
                                {
                                    brush = new SolidBrush(this.BarBrushColor[j % 12]);
                                }
                                if (this.Stroke.TextureEnable)
                                {
                                    pen2 = new Pen(new HatchBrush(this.Stroke.TextureStyle, this.BarPenColor[j % 12], Color.Gray), (float) this.Stroke.Width);
                                }
                                else
                                {
                                    pen2 = new Pen(this.BarPenColor[j % 12], (float) this.Stroke.Width);
                                }
                                pen2.Alignment = PenAlignment.Inset;
                                if (this.Dimension == ChartDimensions.Chart3D)
                                {
                                    this.DrawBarBase3D(g, brush, pen2, barLeft, num17, num14, barH, depth);
                                }
                                else
                                {
                                    this.DrawBarBase2D(g, brush, pen2, barLeft, num17, num14, barH);
                                }
                                if ((this.Crystal.Enable && ((barH - (this.Crystal.Contraction * 2)) > 2)) && ((num14 - (this.Crystal.Contraction * 2)) > 2))
                                {
                                    this.DrawBarCrystal(g, barLeft, num17, num14, barH, depth);
                                }
                                if (this.Tips.Show)
                                {
                                    this.DrawTips(g, this.RawDatas[j][i].ToString(), barLeft, num17, num14, barH, belowX);
                                }
                                if (this.StrBarL == "") 
                                {
                                    this.StrBarL = (barLeft - depth).ToString();
                                    this.StrBarW = num14.ToString();
                                    this.StrBarT = (num17 + depth).ToString();
                                    this.StrBarH = barH.ToString();
                                    this.StrBarV = this.RawDatas[j][i].ToString();
                                }
                                else
                                {
                                    this.StrBarL = this.StrBarL + "," + (barLeft - depth);
                                    this.StrBarW = this.StrBarW + "," + num14;
                                    this.StrBarT = this.StrBarT + "," + (num17 + depth);
                                    this.StrBarH = this.StrBarH + "," + barH;
                                    this.StrBarV = this.StrBarV + "," + this.RawDatas[j][i];
                                }
                                barLeft += num14;
                            }
                        }
                    }
                }
                backPen.Dispose();
            }
            if (this.Dimension == ChartDimensions.Chart2D)
            {
                g.DrawRectangle(Pens.Gray, chartLeft, chartTop, chartW, chartH);
                g.DrawLine(Pens.Black, (float) (chartLeft - 4), (chartTop + chartH) - this.BaseLineXInt, (float) ((chartLeft + chartW) - 1), (chartTop + chartH) - this.BaseLineXInt);
                g.DrawLine(Pens.Black, chartLeft, chartTop, chartLeft, (chartTop + chartH) + 2);
            }
            this.DrawAxisUnit(g, chartLeft, chartTop, chartW, chartH);
            if (base.Site != null)
            {
                this.SaveChart(this.RootPath, image);
            }
            else
            {
                this.SaveChart(HttpContext.Current.Server.MapPath(".") + @"\", image);
            }
            g.Dispose();
            image.Dispose();
        }

        private void DrawHBarChart()
        {
            int num7;
            int width = (int.Parse(this.Width.ToString().Substring(0, this.Width.ToString().Length - 2)) + this.InflateRight) + this.InflateLeft;
            int height = (int.Parse(this.Height.ToString().Substring(0, this.Height.ToString().Length - 2)) + this.InflateBottom) + this.InflateTop;
            Bitmap image = new Bitmap(width, height);
            Graphics g = Graphics.FromImage(image);
            int chartLeft = 50 + this.InflateLeft;
            int chartTop = 60 + this.InflateTop;
            int num5 = 100 + this.InflateRight;
            int num6 = 40 + this.InflateBottom;
            int chartW = (width - chartLeft) - num5;
            int chartH = (height - chartTop) - num6;
            if (!this.ColorGuider.Show)
            {
                chartW += 0x62 - ((int) g.MeasureString(this.XLabels.UnitText, this.XLabels.UnitFont).Width);
                num5 -= 0x62;
            }
            if (!this.YLabels.Show)
            {
                chartW += 0x30;
                chartLeft -= 0x30;
            }
            if (!this.ChartTitle.Show)
            {
                chartH += 0x21;
                chartTop -= 0x21;
            }
            if (this.ShowErrorInfo)
            {
                if (!this.DataBound)
                {
                    this.ChartTitle.Text = "Please bind a data source with BindChartData()!";
                }
                else if (this.MinData < 0f)
                {
                    this.ChartTitle.Text = "HBar Chart can not accept value<0";
                    this.DataBound = false;
                }
            }
            int depth = 0;
            if (this.Dimension == ChartDimensions.Chart3D)
            {
                depth = (int) (this.Depth3D * 0.85);
                this.PaintBackground3D(g, chartLeft, chartTop, chartW, chartH);
                num7 = this.Alpha3D;
            }
            else
            {
                this.PaintBackground(g, chartLeft, chartTop, chartW, chartH);
                num7 = 0xff;
            }
            for (int i = 0; i <= 5; i++)
            {
                this.DrawXLine(g, new Pen(Color.FromArgb(0xff, 220, 220, 220)), (int) (((double) depth) / 0.85), chartTop, chartH, chartLeft + ((chartW * i) / 5), chartW / 5);
                if (this.XLabels.Show)
                {
                    this.DrawXText(g, new Pen(Color.FromArgb(0xff, 220, 220, 220)), (this.MinData + (((this.MaxData - this.MinData) * (5 - i)) / 5f)).ToString(this.YLabels.ValueFormat), (int) (((double) depth) / 0.85), chartTop, chartH, chartLeft + ((chartW * (5 - i)) / 5), chartW / 5);
                }
            }
            if (this.DataBound)
            {
                g.TextRenderingHint = TextRenderingHint.AntiAlias;
                Pen backPen = new Pen(Color.FromArgb(0xff, 220, 220, 220));
                int groupSize = this.GroupSize;
                int maxCount = this.MaxCount;
                if (maxCount > 0)
                {
                    int num14;
                    int num15;
                    if (!this.AutoBarWidth && ((maxCount * groupSize) < 12))
                    {
                        num14 = (chartH / 4) / 0x10;
                        num15 = 5 * num14;
                    }
                    else
                    {
                        num15 = (int) (((double) (chartH / maxCount)) / (0.25 + groupSize));
                        num14 = (int) (0.25 * num15);
                    }
                    for (int j = 0; j < maxCount; j++)
                    {
                        int num16 = j;
                        int barLeft = chartLeft;
                        int barTop = (chartTop + ((num15 * num16) * this.GroupSize)) + (num14 * (num16 + 1));
                        int num21 = (int) (((double) depth) / 0.85);
                        this.DrawYLine(g, backPen, this.AxisX[j], num21, chartLeft, chartTop, chartW, barTop + ((num15 * groupSize) / 2), num15);
                        bool belowX = false;
                        for (int k = 0; k < groupSize; k++)
                        {
                            if (this.RawDatas[k][j] != -0.830213M)
                            {
                                SolidBrush brush;
                                Pen pen2;
                                int barW = (int) ((((this.IntDatas[k][j] * chartW) / ((float) chartH)) - this.BaseLineXInt) - 1f);
                                if ((groupSize == 1) && this.Colorful)
                                {
                                    if (this.Dimension == ChartDimensions.Chart3D)
                                    {
                                        brush = new SolidBrush(Color.FromArgb(num7, this.BarBrushColor[j % 12]));
                                    }
                                    else
                                    {
                                        brush = new SolidBrush(this.BarBrushColor[j % 12]);
                                    }
                                }
                                else if (this.Dimension == ChartDimensions.Chart3D)
                                {
                                    brush = new SolidBrush(Color.FromArgb(num7, this.BarBrushColor[k % 12]));
                                }
                                else
                                {
                                    brush = new SolidBrush(this.BarBrushColor[k % 12]);
                                }
                                if (this.Stroke.TextureEnable)
                                {
                                    pen2 = new Pen(new HatchBrush(this.Stroke.TextureStyle, this.BarPenColor[k % 12], Color.Gray), (float) this.Stroke.Width);
                                }
                                else
                                {
                                    pen2 = new Pen(this.BarPenColor[k % 12], (float) this.Stroke.Width);
                                }
                                pen2.Alignment = PenAlignment.Inset;
                                if (this.Dimension == ChartDimensions.Chart3D)
                                {
                                    this.DrawBarBase3D(g, brush, pen2, barLeft, barTop, barW, num15, depth);
                                }
                                else
                                {
                                    this.DrawBarBase2D(g, brush, pen2, barLeft, barTop, barW, num15);
                                }
                                if ((this.Crystal.Enable && ((num15 - (this.Crystal.Contraction * 2)) > 2)) && ((barW - (this.Crystal.Contraction * 2)) > 2))
                                {
                                    this.DrawBarCrystal(g, barLeft, barTop, barW, num15, depth);
                                }
                                if (this.Tips.Show)
                                {
                                    this.DrawTips(g, this.RawDatas[k][j].ToString(), barLeft, barTop + 15, barW, num15, belowX);
                                }
                                if (this.StrBarL == "")
                                {
                                    this.StrBarL = (barLeft - depth).ToString();
                                    this.StrBarW = barW.ToString();
                                    this.StrBarT = (barTop + depth).ToString();
                                    this.StrBarH = num15.ToString();
                                    this.StrBarV = this.RawDatas[k][j].ToString();
                                }
                                else
                                {
                                    this.StrBarL = this.StrBarL + "," + (barLeft - depth);
                                    this.StrBarW = this.StrBarW + "," + barW;
                                    this.StrBarT = this.StrBarT + "," + (barTop + depth);
                                    this.StrBarH = this.StrBarH + "," + num15;
                                    this.StrBarV = this.StrBarV + "," + this.RawDatas[k][j];
                                }
                                barTop += num15;
                            }
                        }
                    }
                }
                backPen.Dispose();
            }
            if (this.Dimension == ChartDimensions.Chart2D)
            {
                g.DrawRectangle(Pens.Gray, chartLeft, chartTop, chartW, chartH);
                g.DrawLine(Pens.Black, (float) (chartLeft - 4), (chartTop + chartH) - this.BaseLineXInt, (float) ((chartLeft + chartW) - 1), (chartTop + chartH) - this.BaseLineXInt);
                g.DrawLine(Pens.Black, chartLeft, chartTop, chartLeft, (chartTop + chartH) + 2);
            }
            string unitText = this.YLabels.UnitText;
            this.YLabels.UnitText = this.XLabels.UnitText;
            this.XLabels.UnitText = unitText;
            this.DrawAxisUnit(g, chartLeft, chartTop, chartW + 10, chartH);
            if (base.Site != null)
            {
                this.SaveChart(this.RootPath, image);
            }
            else
            {
                this.SaveChart(HttpContext.Current.Server.MapPath(".") + @"\", image);
            }
            g.Dispose();
            image.Dispose();
        }

        private void DrawLineChart()
        {
            int num7;
            int width = (int.Parse(this.Width.ToString().Substring(0, this.Width.ToString().Length - 2)) + this.InflateRight) + this.InflateLeft;
            int height = (int.Parse(this.Height.ToString().Substring(0, this.Height.ToString().Length - 2)) + this.InflateBottom) + this.InflateTop;
            Bitmap image = new Bitmap(width, height);
            Graphics g = Graphics.FromImage(image);
            int chartLeft = 50 + this.InflateLeft;
            int chartTop = 60 + this.InflateTop;
            int num5 = 100 + this.InflateRight;
            int num6 = 40 + this.InflateBottom;
            int chartW = (width - chartLeft) - num5;
            int chartH = (height - chartTop) - num6;
            if (!this.ColorGuider.Show)
            {
                chartW += 0x62 - ((int) g.MeasureString(this.XLabels.UnitText, this.XLabels.UnitFont).Width);
                num5 -= 0x62;
            }
            if (!this.YLabels.Show)
            {
                chartW += 0x30;
                chartLeft -= 0x30;
            }
            if (!this.ChartTitle.Show)
            {
                chartH += 0x21;
                chartTop -= 0x21;
            }
            if (!this.DataBound && this.ShowErrorInfo)
            {
                this.ChartTitle.Text = "Please bind a data source with BindChartData()!";
            }
            int num10 = 0;
            int num11 = 0;
            if (this.Dimension == ChartDimensions.Chart3D)
            {
                num10 = (int) (this.Depth3D * 0.85);
                num11 = this.Depth3D;
                this.PaintBackground3D(g, chartLeft, chartTop, chartW, chartH);
                num7 = this.Alpha3D;
            }
            else
            {
                this.PaintBackground(g, chartLeft, chartTop, chartW, chartH);
                num7 = 0xff;
            }
            Pen backPen = new Pen(Color.FromArgb(0xff, 220, 220, 220));
            if (this.DataBound)
            {
                g.SmoothingMode = SmoothingMode.AntiAlias;
                g.TextRenderingHint = TextRenderingHint.AntiAlias;
                int groupSize = this.GroupSize;
                int maxCount = this.MaxCount;
                if (maxCount > 0)
                {
                    int xWidth = chartW / maxCount;
                    for (int i = 0; i < groupSize; i++)
                    {
                        Pen pen2;
                        Color[] colorArray3;
                        float[] numArray3;
                        SolidBrush brush = new SolidBrush(Color.FromArgb(num7, this.BarPenColor[i % 12]));
                        if (this.Stroke.TextureEnable)
                        {
                            pen2 = new Pen(new HatchBrush(this.Stroke.TextureStyle, this.BarPenColor[i % 12], Color.Black), (float) this.Stroke.Width);
                        }
                        else
                        {
                            pen2 = new Pen(this.BarPenColor[i % 12], (float) this.Stroke.Width);
                        }
                        GraphicsPath gp = new GraphicsPath();
                        int xPos = xWidth / 2;
                        xPos += chartLeft;
                        int index = 0;
                        while (index < (maxCount - 1))
                        {
                            if (i == 0)
                            {
                                this.DrawXLine(g, backPen, num11, chartTop, chartH, xPos, xWidth);
                                if (this.XLabels.Show && ((index % this.XLabels.SampleSize) == 0))
                                {
                                    this.DrawXText(g, backPen, this.AxisX[index], num11, chartTop, chartH, xPos, xWidth);
                                }
                            }
                            if (this.RawDatas[i][index] != -0.830213M)
                            {
                                g.SmoothingMode = SmoothingMode.AntiAlias;
                                if (this.Dimension == ChartDimensions.Chart2D)
                                {
                                    if (this.RawDatas[i][index + 1] != -0.830213M)
                                    {
                                        gp.AddLine((float) xPos, (chartTop + chartH) - this.IntDatas[i][index], (float) (xPos + xWidth), (chartTop + chartH) - this.IntDatas[i][index + 1]);
                                    }
                                    else
                                    {
                                        gp.StartFigure();
                                    }
                                }
                                else
                                {
                                    float num18 = this.LineConnectionRadius / 2;
                                    if (this.LineConnectionType == LineConnectionTypes.None)
                                    {
                                        num18 = 0f;
                                    }
                                    GraphicsPath path = new GraphicsPath();
                                    if (this.LineConnectionType == LineConnectionTypes.Square)
                                    {
                                        path.Reset();
                                        path.StartFigure();
                                        path.AddLine((float) (xPos - num18), (float) (((chartTop + chartH) - this.IntDatas[i][index]) - num18), (float) ((xPos - num18) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) - num18) + num10));
                                        path.AddLine((float) ((xPos - num18) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) - num18) + num10), (float) ((xPos + num18) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) - num18) + num10));
                                        path.AddLine((float) ((xPos + num18) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) - num18) + num10), (float) (xPos + num18), (float) (((chartTop + chartH) - this.IntDatas[i][index]) - num18));
                                        path.AddLine((float) (xPos + num18), (float) (((chartTop + chartH) - this.IntDatas[i][index]) - num18), (float) (xPos - num18), (float) (((chartTop + chartH) - this.IntDatas[i][index]) - num18));
                                        path.StartFigure();
                                        path.AddLine((float) ((xPos - num18) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) - num18) + num10), (float) ((xPos + num18) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) - num18) + num10));
                                        path.AddLine((float) ((xPos + num18) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) - num18) + num10), (float) ((xPos + num18) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) + num18) + num10));
                                        path.AddLine((float) ((xPos + num18) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) + num18) + num10), (float) ((xPos - num18) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) + num18) + num10));
                                        path.AddLine((float) ((xPos - num18) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) + num18) + num10), (float) ((xPos - num18) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) - num18) + num10));
                                        path.StartFigure();
                                        path.AddLine((float) ((xPos + num18) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) - num18) + num10), (float) (xPos + num18), (float) (((chartTop + chartH) - this.IntDatas[i][index]) - num18));
                                        path.AddLine((float) (xPos + num18), (float) (((chartTop + chartH) - this.IntDatas[i][index]) - num18), (float) (xPos + num18), (float) (((chartTop + chartH) - this.IntDatas[i][index]) + num18));
                                        path.AddLine((float) (xPos + num18), (float) (((chartTop + chartH) - this.IntDatas[i][index]) + num18), (float) ((xPos + num18) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) + num18) + num10));
                                        path.AddLine((float) ((xPos + num18) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) + num18) + num10), (float) ((xPos + num18) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) - num18) + num10));
                                        g.FillPath(brush, path);
                                        g.DrawPath(pen2, path);
                                    }
                                    else if (this.LineConnectionType == LineConnectionTypes.Round)
                                    {
                                        path.Reset();
                                        path.AddArc(xPos - ((int) num18), (int) (((chartTop + chartH) - this.IntDatas[i][index]) - num18), this.LineConnectionRadius, this.LineConnectionRadius, 225f, 180f);
                                        PointF tf = path.PathPoints[0];
                                        PointF tf2 = path.PathPoints[path.PathPoints.Length - 1];
                                        PointF tf3 = tf + new SizeF((float) (-1 * num10), (float) num10);
                                        PointF tf4 = tf2 + new SizeF((float) (-1 * num10), (float) num10);
                                        colorArray3 = new Color[] { this.BarPenColor[i % 12], Color.White, this.BarPenColor[i % 12] };
                                        Color[] colorArray = colorArray3;
                                        numArray3 = new float[3];
                                        numArray3[1] = 0.3f;
                                        numArray3[2] = 1f;
                                        float[] numArray = numArray3;
                                        ColorBlend blend = new ColorBlend();
                                        blend.Colors = colorArray;
                                        blend.Positions = numArray;
                                        LinearGradientBrush brush2 = new LinearGradientBrush(tf, tf2, Color.Red, Color.Red);
                                        brush2.InterpolationColors = blend;
                                        path.Reset();
                                        path.StartFigure();
                                        path.AddArc(xPos - ((int) num18), (int) (((chartTop + chartH) - this.IntDatas[i][index]) - num18), this.LineConnectionRadius, this.LineConnectionRadius, 225f, 180f);
                                        path.AddLine(tf2, tf4);
                                        path.AddArc((xPos - ((int) num18)) - num10, ((int) (((chartTop + chartH) - this.IntDatas[i][index]) - num18)) + num10, this.LineConnectionRadius, this.LineConnectionRadius, 225f, 180f);
                                        path.AddLine(tf3, tf);
                                        g.FillPath(brush2, path);
                                        g.DrawPath(pen2, path);
                                        brush2.Dispose();
                                        path.Reset();
                                        path.StartFigure();
                                        path.AddEllipse((xPos - ((int) num18)) - num10, ((int) (((chartTop + chartH) - this.IntDatas[i][index]) - num18)) + num10, this.LineConnectionRadius, this.LineConnectionRadius);
                                        g.FillPath(new SolidBrush(Color.FromArgb(0xff, this.BarPenColor[i % 12])), path);
                                        g.DrawPath(pen2, path);
                                    }
                                    if (this.RawDatas[i][index + 1] != -0.830213M)
                                    {
                                        path.Reset();
                                        path.AddLine((float) (xPos + num18), (float) ((chartTop + chartH) - this.IntDatas[i][index]), (float) ((xPos + num18) - num10), (float) (((chartTop + chartH) - this.IntDatas[i][index]) + num10));
                                        path.AddLine((float) ((xPos + num18) - num10), (float) (((chartTop + chartH) - this.IntDatas[i][index]) + num10), (float) (((xPos + xWidth) - num18) - num10), (float) (((chartTop + chartH) - this.IntDatas[i][index + 1]) + num10));
                                        path.AddLine((float) (((xPos + xWidth) - num18) - num10), (float) (((chartTop + chartH) - this.IntDatas[i][index + 1]) + num10), (float) ((xPos + xWidth) - num18), (float) ((chartTop + chartH) - this.IntDatas[i][index + 1]));
                                        path.AddLine((float) ((xPos + xWidth) - num18), (float) ((chartTop + chartH) - this.IntDatas[i][index + 1]), (float) (xPos + num18), (float) ((chartTop + chartH) - this.IntDatas[i][index]));
                                        g.FillPath(brush, path);
                                    }
                                    if (this.Crystal.Enable)
                                    {
                                        Point point;
                                        Point point2;
                                        if (this.Crystal.Direction == Direction.LeftRight)
                                        {
                                            point = new Point((xPos + ((int) num18)) - num10, ((chartTop + chartH) - ((int) this.IntDatas[i][index])) + num10);
                                            point2 = new Point((xPos + xWidth) - ((int) num18), (chartTop + chartH) - ((int) this.IntDatas[i][index + 1]));
                                        }
                                        else if (this.Crystal.Direction == Direction.RightLeft)
                                        {
                                            point2 = new Point((xPos + ((int) num18)) - num10, ((chartTop + chartH) - ((int) this.IntDatas[i][index])) + num10);
                                            point = new Point((xPos + xWidth) - ((int) num18), (chartTop + chartH) - ((int) this.IntDatas[i][index + 1]));
                                        }
                                        else if (this.Crystal.Direction == Direction.TopBottom)
                                        {
                                            point = new Point(xPos + ((int) num18), (chartTop + chartH) - ((int) this.IntDatas[i][index]));
                                            point2 = new Point((xPos + ((int) num18)) - num10, ((chartTop + chartH) - ((int) this.IntDatas[i][index])) + num10);
                                        }
                                        else
                                        {
                                            point2 = new Point(xPos + ((int) num18), (chartTop + chartH) - ((int) this.IntDatas[i][index]));
                                            point = new Point((xPos + ((int) num18)) - num10, ((chartTop + chartH) - ((int) this.IntDatas[i][index])) + num10);
                                        }
                                        LinearGradientBrush brush3 = new LinearGradientBrush(point, point2, Color.FromArgb(0xb2, Color.White), Color.FromArgb(0x19, Color.White));
                                        g.FillPath(brush3, path);
                                        brush3.Dispose();
                                    }
                                    g.DrawPath(pen2, path);
                                    path.Dispose();
                                    if (this.Tips.Show && (this.RawDatas[i][index] != -0.830213M))
                                    {
                                        SizeF ef = g.MeasureString(this.RawDatas[i][index].ToString(), this.Tips.Font);
                                        StringFormat format = new StringFormat();
                                        format.Alignment = StringAlignment.Center;
                                        g.DrawString(this.RawDatas[i][index].ToString(), this.Tips.Font, new SolidBrush(this.Tips.ForeColor), new RectangleF(xPos - ef.Width, (float) ((int) ((((chartTop + chartH) - this.IntDatas[i][index]) - (this.LineConnectionRadius / 2)) - 14f)), ef.Width, ef.Height), format);
                                        format.Dispose();
                                    }
                                    if (this.StrBarL == "")
                                    {
                                        this.StrBarL = ((xPos - num10) - ((this.LineConnectionRadius + 4) / 2)).ToString();
                                        this.StrBarW = (this.LineConnectionRadius + 4).ToString();
                                        this.StrBarT = ((((chartTop + num10) + chartH) - this.IntDatas[i][index]) - ((this.LineConnectionRadius + 4) / 2)).ToString();
                                        this.StrBarH = (this.LineConnectionRadius + 4).ToString();
                                        this.StrBarV = this.RawDatas[i][index].ToString();
                                    }
                                    else
                                    {
                                        this.StrBarL = this.StrBarL + "," + ((xPos - num10) - ((this.LineConnectionRadius + 4) / 2));
                                        this.StrBarW = this.StrBarW + "," + (this.LineConnectionRadius + 4);
                                        this.StrBarT = this.StrBarT + "," + ((((chartTop + num10) + chartH) - this.IntDatas[i][index]) - ((this.LineConnectionRadius + 4) / 2));
                                        this.StrBarH = this.StrBarH + "," + (this.LineConnectionRadius + 4);
                                        this.StrBarV = this.StrBarV + "," + this.RawDatas[i][index];
                                    }
                                }
                            }
                            else
                            {
                                gp.StartFigure();
                            }
                            xPos += xWidth;
                            index++;
                        }
                        if (this.Dimension == ChartDimensions.Chart2D)
                        {
                            if (this.Shadow.Enable)
                            {
                                TextShadow shadow = new TextShadow();
                                shadow.Radius = this.Shadow.Radius;
                                shadow.Distance = this.Shadow.Distance;
                                shadow.Alpha = this.Shadow.Alpha;
                                shadow.Angle = this.Shadow.Angle;
                                shadow.DropShadow(g, new Rectangle((int) gp.GetBounds().Left, (int) gp.GetBounds().Top, (int) gp.GetBounds().Width, (int) gp.GetBounds().Height), this.Shadow.Color, "Draw", "Path", gp, this.Stroke.Width);
                            }
                            g.DrawPath(pen2, gp);
                        }
                        if ((i == 0) && (i == 0))
                        {
                            this.DrawXLine(g, backPen, num11, chartTop, chartH, xPos, xWidth);
                            if (this.XLabels.Show && ((index % this.XLabels.SampleSize) == 0))
                            {
                                this.DrawXText(g, backPen, this.AxisX[index], num11, chartTop, chartH, xPos, xWidth);
                            }
                        }
                        if ((this.Dimension == ChartDimensions.Chart3D) && (this.RawDatas[i][index] != -0.830213M))
                        {
                            float num19 = this.LineConnectionRadius / 2;
                            GraphicsPath path3 = new GraphicsPath();
                            if (this.LineConnectionType == LineConnectionTypes.None)
                            {
                                num19 = 0f;
                            }
                            else if (this.LineConnectionType == LineConnectionTypes.Square)
                            {
                                path3.Reset();
                                path3.StartFigure();
                                path3.AddLine((float) (xPos - num19), (float) (((chartTop + chartH) - this.IntDatas[i][index]) - num19), (float) ((xPos - num19) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) - num19) + num10));
                                path3.AddLine((float) ((xPos - num19) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) - num19) + num10), (float) ((xPos + num19) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) - num19) + num10));
                                path3.AddLine((float) ((xPos + num19) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) - num19) + num10), (float) (xPos + num19), (float) (((chartTop + chartH) - this.IntDatas[i][index]) - num19));
                                path3.AddLine((float) (xPos + num19), (float) (((chartTop + chartH) - this.IntDatas[i][index]) - num19), (float) (xPos - num19), (float) (((chartTop + chartH) - this.IntDatas[i][index]) - num19));
                                path3.StartFigure();
                                path3.AddLine((float) ((xPos - num19) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) - num19) + num10), (float) ((xPos + num19) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) - num19) + num10));
                                path3.AddLine((float) ((xPos + num19) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) - num19) + num10), (float) ((xPos + num19) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) + num19) + num10));
                                path3.AddLine((float) ((xPos + num19) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) + num19) + num10), (float) ((xPos - num19) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) + num19) + num10));
                                path3.AddLine((float) ((xPos - num19) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) + num19) + num10), (float) ((xPos - num19) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) - num19) + num10));
                                path3.StartFigure();
                                path3.AddLine((float) ((xPos + num19) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) - num19) + num10), (float) (xPos + num19), (float) (((chartTop + chartH) - this.IntDatas[i][index]) - num19));
                                path3.AddLine((float) (xPos + num19), (float) (((chartTop + chartH) - this.IntDatas[i][index]) - num19), (float) (xPos + num19), (float) (((chartTop + chartH) - this.IntDatas[i][index]) + num19));
                                path3.AddLine((float) (xPos + num19), (float) (((chartTop + chartH) - this.IntDatas[i][index]) + num19), (float) ((xPos + num19) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) + num19) + num10));
                                path3.AddLine((float) ((xPos + num19) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) + num19) + num10), (float) ((xPos + num19) - num10), (float) ((((chartTop + chartH) - this.IntDatas[i][index]) - num19) + num10));
                                g.FillPath(brush, path3);
                                g.DrawPath(pen2, path3);
                                path3.Dispose();
                            }
                            else if (this.LineConnectionType == LineConnectionTypes.Round)
                            {
                                path3.Reset();
                                path3.AddArc(xPos - ((int) num19), (int) (((chartTop + chartH) - this.IntDatas[i][index]) - num19), this.LineConnectionRadius, this.LineConnectionRadius, 225f, 180f);
                                PointF tf5 = path3.PathPoints[0];
                                PointF tf6 = path3.PathPoints[path3.PathPoints.Length - 1];
                                PointF tf7 = tf5 + new SizeF((float) (-1 * num10), (float) num10);
                                PointF tf8 = tf6 + new SizeF((float) (-1 * num10), (float) num10);
                                colorArray3 = new Color[] { this.BarPenColor[i % 12], Color.White, this.BarPenColor[i % 12] };
                                Color[] colorArray2 = colorArray3;
                                numArray3 = new float[3];
                                numArray3[1] = 0.3f;
                                numArray3[2] = 1f;
                                float[] numArray2 = numArray3;
                                ColorBlend blend2 = new ColorBlend();
                                blend2.Colors = colorArray2;
                                blend2.Positions = numArray2;
                                LinearGradientBrush brush4 = new LinearGradientBrush(tf5, tf6, Color.Red, Color.Red);
                                brush4.InterpolationColors = blend2;
                                path3.Reset();
                                path3.StartFigure();
                                path3.AddArc(xPos - ((int) num19), (int) (((chartTop + chartH) - this.IntDatas[i][index]) - num19), this.LineConnectionRadius, this.LineConnectionRadius, 225f, 180f);
                                path3.AddLine(tf6, tf8);
                                path3.AddArc((xPos - ((int) num19)) - num10, ((int) (((chartTop + chartH) - this.IntDatas[i][index]) - num19)) + num10, this.LineConnectionRadius, this.LineConnectionRadius, 225f, 180f);
                                path3.AddLine(tf7, tf5);
                                g.FillPath(brush4, path3);
                                g.DrawPath(pen2, path3);
                                brush4.Dispose();
                                path3.Reset();
                                path3.StartFigure();
                                path3.AddEllipse((xPos - ((int) num19)) - num10, ((int) (((chartTop + chartH) - this.IntDatas[i][index]) - num19)) + num10, this.LineConnectionRadius, this.LineConnectionRadius);
                                g.FillPath(new SolidBrush(Color.FromArgb(0xff, this.BarPenColor[i % 12])), path3);
                                g.DrawPath(pen2, path3);
                            }
                            if (this.Tips.Show)
                            {
                                SizeF ef2 = g.MeasureString(this.RawDatas[i][index].ToString(), this.Tips.Font);
                                StringFormat format2 = new StringFormat();
                                format2.Alignment = StringAlignment.Center;
                                g.DrawString(this.RawDatas[i][index].ToString(), this.Tips.Font, new SolidBrush(this.Tips.ForeColor), new RectangleF(xPos - ef2.Width, (float) ((int) ((((chartTop + chartH) - this.IntDatas[i][index]) - (this.LineConnectionRadius / 2)) - 14f)), ef2.Width, ef2.Height), format2);
                                format2.Dispose();
                            }
                            if (this.StrBarL == "")
                            {
                                this.StrBarL = ((xPos - num10) - ((this.LineConnectionRadius + 4) / 2)).ToString();
                                this.StrBarW = (this.LineConnectionRadius + 4).ToString();
                                this.StrBarT = ((((chartTop + num10) + chartH) - this.IntDatas[i][index]) - ((this.LineConnectionRadius + 4) / 2)).ToString();
                                this.StrBarH = (this.LineConnectionRadius + 4).ToString();
                                this.StrBarV = this.RawDatas[i][index].ToString();
                            }
                            else
                            {
                                this.StrBarL = this.StrBarL + "," + ((xPos - num10) - ((this.LineConnectionRadius + 4) / 2));
                                this.StrBarW = this.StrBarW + "," + (this.LineConnectionRadius + 4);
                                this.StrBarT = this.StrBarT + "," + ((((chartTop + num10) + chartH) - this.IntDatas[i][index]) - ((this.LineConnectionRadius + 4) / 2));
                                this.StrBarH = this.StrBarH + "," + (this.LineConnectionRadius + 4);
                                this.StrBarV = this.StrBarV + "," + this.RawDatas[i][index];
                            }
                        }
                        pen2.Dispose();
                        gp.Dispose();
                        if (this.Dimension == ChartDimensions.Chart2D)
                        {
                            xPos = (xWidth / 2) + chartLeft;
                            LineConnectionTypes lineConnectionType = this.LineConnectionType;
                            int lineConnectionRadius = this.LineConnectionRadius;
                            switch (lineConnectionType)
                            {
                                case LineConnectionTypes.Round:
                                    g.SmoothingMode = SmoothingMode.AntiAlias;
                                    break;

                                case LineConnectionTypes.Square:
                                    g.SmoothingMode = SmoothingMode.None;
                                    break;
                            }
                            for (int j = 0; j < maxCount; j++)
                            {
                                if (this.RawDatas[i][j] != -0.830213M)
                                {
                                    switch (lineConnectionType)
                                    {
                                        case LineConnectionTypes.Round:
                                            g.FillEllipse(brush, (float) (xPos - (lineConnectionRadius / 2)), ((chartTop + chartH) - this.IntDatas[i][j]) - (lineConnectionRadius / 2), (float) lineConnectionRadius, (float) lineConnectionRadius);
                                            break;

                                        case LineConnectionTypes.Square:
                                            g.FillRectangle(brush, (float) (xPos - (lineConnectionRadius / 2)), ((chartTop + chartH) - this.IntDatas[i][j]) - (lineConnectionRadius / 2), (float) lineConnectionRadius, (float) lineConnectionRadius);
                                            break;
                                    }
                                    if (this.Tips.Show)
                                    {
                                        SizeF ef3 = g.MeasureString(this.RawDatas[i][j].ToString(), this.Tips.Font);
                                        StringFormat format3 = new StringFormat();
                                        format3.Alignment = StringAlignment.Center;
                                        g.DrawString(this.RawDatas[i][j].ToString(), this.Tips.Font, new SolidBrush(this.Tips.ForeColor), new RectangleF(xPos - ef3.Width, (float) ((int) ((((chartTop + chartH) - this.IntDatas[i][j]) - (lineConnectionRadius / 2)) - 14f)), ef3.Width, ef3.Height), format3);
                                        format3.Dispose();
                                    }
                                    if (this.StrBarL == "")
                                    {
                                        this.StrBarL = (xPos - ((this.LineConnectionRadius + 4) / 2)).ToString();
                                        this.StrBarW = (this.LineConnectionRadius + 4).ToString();
                                        this.StrBarT = (((chartTop + chartH) - this.IntDatas[i][j]) - ((this.LineConnectionRadius + 4) / 2)).ToString();
                                        this.StrBarH = (this.LineConnectionRadius + 4).ToString();
                                        this.StrBarV = this.RawDatas[i][j].ToString();
                                    }
                                    else
                                    {
                                        this.StrBarL = this.StrBarL + "," + (xPos - ((this.LineConnectionRadius + 4) / 2));
                                        this.StrBarW = this.StrBarW + "," + (this.LineConnectionRadius + 4);
                                        this.StrBarT = this.StrBarT + "," + (((chartTop + chartH) - this.IntDatas[i][j]) - ((this.LineConnectionRadius + 4) / 2));
                                        this.StrBarH = this.StrBarH + "," + (this.LineConnectionRadius + 4);
                                        this.StrBarV = this.StrBarV + "," + this.RawDatas[i][j];
                                    }
                                }
                                xPos += xWidth;
                            }
                            g.SmoothingMode = SmoothingMode.AntiAlias;
                        }
                    }
                }
            }
            if (this.Dimension == ChartDimensions.Chart2D)
            {
                g.DrawRectangle(Pens.Gray, chartLeft, chartTop, chartW, chartH);
                g.DrawLine(Pens.Black, (float) (chartLeft - 4), (chartTop + chartH) - this.BaseLineXInt, (float) ((chartLeft + chartW) - 1), (chartTop + chartH) - this.BaseLineXInt);
                g.DrawLine(Pens.Black, chartLeft, chartTop, chartLeft, (chartTop + chartH) + 2);
            }
            this.DrawAxisUnit(g, chartLeft, chartTop, chartW, chartH);
            if (base.Site != null)
            {
                this.SaveChart(this.RootPath, image);
            }
            else
            {
                this.SaveChart(HttpContext.Current.Server.MapPath(".") + @"\", image);
            }
            g.Dispose();
            image.Dispose();
        }

        private void DrawPieChart()
        {
            int width = (int.Parse(this.Width.ToString().Substring(0, this.Width.ToString().Length - 2)) + this.InflateRight) + this.InflateLeft;
            int height = (int.Parse(this.Height.ToString().Substring(0, this.Height.ToString().Length - 2)) + this.InflateBottom) + this.InflateTop;
            Bitmap image = new Bitmap(width, height);
            Graphics g = Graphics.FromImage(image);
            int num3 = 50 + this.InflateLeft;
            int num4 = 60 + this.InflateTop;
            int num5 = 100 + this.InflateRight;
            int num6 = 40 + this.InflateBottom;
            int num7 = (width - num3) - num5;
            int num8 = (height - num4) - num6;
            if (!this.ColorGuider.Show)
            {
                num7 += 0x62 - ((int) g.MeasureString(this.XLabels.UnitText, this.XLabels.UnitFont).Width);
                num5 -= 0x62;
            }
            if (!this.ChartTitle.Show)
            {
                num8 += 0x21;
                num4 -= 0x21;
            }
            g.FillRectangle(new SolidBrush(this.Background.Paper), 0, 0, width + this.InflateRight, height + this.InflateBottom);
            g.TextRenderingHint = TextRenderingHint.AntiAlias;
            if (this.ShowCopyright)
            {
                g.DrawString(this.CopyrightText, new Font("Arial", 12f, FontStyle.Italic, GraphicsUnit.Pixel), Brushes.Gray, (float) (width - 130), 0f);
            }
            if (!this.DataBound && this.ShowErrorInfo)
            {
                this.ChartTitle.Text = "Please bind a data source with BindChartData()!";
            }
            else if (this.MinData < 0f)
            {
                this.DataBound = false;
                if (this.ShowErrorInfo)
                {
                    this.ChartTitle.Text = "PieBar can not accept value < 0";
                }
            }
            StringFormat format = new StringFormat();
            format.LineAlignment = StringAlignment.Center;
            format.Alignment = StringAlignment.Center;
            if (this.ChartTitle.Show)
            {
                g.DrawString(this.ChartTitle.Text, this.ChartTitle.Font, new SolidBrush(this.ChartTitle.ForeColor), new Rectangle((num3 + (num7 / 2)) - 160, num4 - 40, 300, 40), format);
            }
            if (this.DataBound)
            {
                int num12;
                int num13;
                int num14;
                int num15;
                if ((this.AxisX != null) && this.ColorGuider.Show)
                {
                    for (int k = 0; k < this.MinCount; k++)
                    {
                        SolidBrush brush = new SolidBrush(this.BarBrushColor[k % 12]);
                        g.FillRectangle(brush, ((num3 + num7) + 6) + ((int) ((width - num7) * 0.2)), (num4 + (14 * k)) + 4, 0x12, 8);
                        g.DrawRectangle(Pens.Gray, ((num3 + num7) + 6) + ((int) ((width - num7) * 0.2)), (num4 + 4) + (14 * k), 0x11, 7);
                        g.TextRenderingHint = TextRenderingHint.AntiAlias;
                        g.DrawString(this.AxisX[k], this.ColorGuider.Font, new SolidBrush(this.ColorGuider.ForeColor), (float) (((num3 + num7) + 0x1c) + ((int) ((width - num7) * 0.2))), (float) ((num4 + 1) + (14 * k)));
                        brush.Dispose();
                    }
                }
                float sum = this.GetSum(this.RawDatas[0]);
                for (int i = 0; i < this.RawDatas[0].Length; i++)
                {
                    this.IntDatas[0][i] = ((float) this.RawDatas[0][i]) / sum;
                }
                g.SmoothingMode = SmoothingMode.AntiAlias;
                if (num7 > num8)
                {
                    num14 = num8;
                    num15 = num14;
                    num12 = num3 + ((num7 - num8) / 2);
                    num13 = num4;
                }
                else
                {
                    num14 = num7;
                    num15 = num14;
                    num12 = num3;
                    num13 = num4 + ((num8 - num7) / 2);
                }
                Rectangle r = new Rectangle(num12, num13, num14, num15);
                r.Inflate(-10, -10);
                float num16 = num12 + (num14 / 2);
                float num17 = num13 + (num15 / 2);
                if (this.Shadow.Enable)
                {
                    TextShadow shadow = new TextShadow();
                    shadow.Radius = this.Shadow.Radius;
                    shadow.Distance = this.Shadow.Distance;
                    shadow.Alpha = this.Shadow.Alpha;
                    shadow.Angle = this.Shadow.Angle;
                    shadow.DropShadow(g, r, this.Shadow.Color, "Fill", "Ellipse", null, 1);
                }
                float num18 = num13;
                float num19 = num12;
                float num20 = num13;
                float startAngle = 0f;
                int num22 = 0;
                if (this.Tips.Show)
                {
                    num22 = 10;
                }
                g.TextRenderingHint = TextRenderingHint.AntiAlias;
                for (int j = 0; j < this.IntDatas[0].Length; j++)
                {
                    Pen pen;
                    float num27;
                    g.SmoothingMode = SmoothingMode.AntiAlias;
                    SolidBrush brush2 = new SolidBrush(this.BarBrushColor[j % 12]);
                    if (this.Stroke.TextureEnable)
                    {
                        pen = new Pen(new HatchBrush(this.Stroke.TextureStyle, this.BarPenColor[0], Color.Black), (float) this.Stroke.Width);
                    }
                    else
                    {
                        pen = new Pen(this.BarPenColor[0], (float) this.Stroke.Width);
                    }
                    g.FillPie(brush2, r, startAngle, this.IntDatas[0][j] * 360f);
                    if (this.Stroke.Width > 0)
                    {
                        g.DrawPie(pen, r, startAngle, this.IntDatas[0][j] * 360f);
                    }
                    float num24 = num17 + ((((float) Math.Sin(((startAngle + (this.IntDatas[0][j] * 180f)) * 3.1415926535897931) / 180.0)) * r.Width) / 2f);
                    float num25 = num24;
                    float num26 = num16 + ((((float) Math.Cos(((startAngle + (this.IntDatas[0][j] * 180f)) * 3.1415926535897931) / 180.0)) * r.Width) / 2f);
                    if (((startAngle + (this.IntDatas[0][j] * 180f)) > 90f) && ((startAngle + (this.IntDatas[0][j] * 180f)) < 270f))
                    {
                        num27 = (num12 - 40) - 50;
                        if (((Math.Abs((float) (num24 - num18)) < (0x10 + num22)) || (Math.Abs((float) (num25 - num20)) < (0x10 + num22))) && (Math.Abs((float) (num27 - num19)) < (num7 / 2)))
                        {
                            num24 = (num18 - 16f) + num22;
                        }
                        if ((this.IntDatas[0][j] * 180f) < 360f)
                        {
                            g.DrawLine(Pens.Gray, num26 - 2f, num25, num27 + 85f, num24);
                        }
                    }
                    else
                    {
                        num27 = (num12 + num14) + 10;
                        if (((Math.Abs((float) (num24 - num18)) < (0x10 + num22)) || (Math.Abs((float) (num25 - num20)) < (0x10 + num22))) && (Math.Abs((float) (num27 - num19)) < (num7 / 2)))
                        {
                            num24 = (num18 + 16f) + num22;
                        }
                        if ((this.IntDatas[0][j] * 180f) < 360f)
                        {
                            g.DrawLine(Pens.Gray, num26 + 2f, num25, num27 - 2f, num24);
                        }
                    }
                    g.TextRenderingHint = TextRenderingHint.AntiAlias;
                    string s = "";
                    if (this.Tips.Show)
                    {
                        s = string.Concat(new object[] { this.AxisX[j], "\n", this.RawDatas[0][j], " " });
                    }
                    s = s + ((this.IntDatas[0][j] * 100f)).ToString("0.00") + "%";
                    if ((this.IntDatas[0][j] * 180f) < 360f)
                    {
                        g.DrawString(s, this.Tips.Font, new SolidBrush(this.Tips.ForeColor), num27, (num24 - 6f) - 5f);
                    }
                    else
                    {
                        g.DrawString(s, this.Tips.Font, new SolidBrush(this.Tips.ForeColor), (float) ((num26 - 50f) - num22), (float) ((num25 - 6f) - 5f));
                    }
                    num18 = num24;
                    num19 = num27;
                    num20 = num25;
                    startAngle += this.IntDatas[0][j] * 360f;
                    pen.Dispose();
                    brush2.Dispose();
                }
                if (this.Crystal.Enable)
                {
                    g.SmoothingMode = SmoothingMode.AntiAlias;
                    if (this.Crystal.CoverFull)
                    {
                        g.SmoothingMode = SmoothingMode.AntiAlias;
                        Rectangle rect = new Rectangle(r.Left - (r.Width / 4), r.Top - (r.Height / 4), r.Width, r.Height);
                        GraphicsPath path = new GraphicsPath();
                        path.AddEllipse(rect);
                        PathGradientBrush brush3 = new PathGradientBrush(path);
                        brush3.CenterColor = Color.FromArgb(0xa5, Color.White);
                        brush3.SurroundColors = new Color[] { Color.FromArgb(0, Color.White) };
                        Region region = new Region(path);
                        g.SetClip(region, CombineMode.Intersect);
                        path = new GraphicsPath();
                        path.AddEllipse(r);
                        region = new Region(path);
                        g.SetClip(region, CombineMode.Intersect);
                        g.FillEllipse(brush3, rect);
                        brush3.Dispose();
                        region.Dispose();
                        path.Dispose();
                        g.SmoothingMode = SmoothingMode.None;
                    }
                    else
                    {
                        int num28 = 3;
                        Rectangle rectangle3 = new Rectangle(r.Left + (r.Width / 6), r.Top + num28, (r.Width * 2) / 3, (r.Height / 2) - num28);
                        LinearGradientBrush brush4 = new LinearGradientBrush(new Point(rectangle3.Left, rectangle3.Top), new Point(rectangle3.Left, (rectangle3.Top + rectangle3.Height) + 1), Color.FromArgb(230, Color.White), Color.FromArgb(0, Color.White));
                        g.FillEllipse(brush4, rectangle3);
                        brush4.Dispose();
                        Rectangle rectangle4 = new Rectangle(r.Left, (r.Top + (r.Height / 2)) + 1, r.Width, (r.Height / 2) + 1);
                        LinearGradientBrush brush5 = new LinearGradientBrush(new Point(rectangle4.Left, rectangle4.Top + rectangle4.Height), new Point(rectangle4.Left, rectangle4.Top), Color.FromArgb(230, Color.White), Color.FromArgb(0, Color.White));
                        GraphicsPath path2 = new GraphicsPath();
                        r.Inflate(1, 1);
                        path2.AddEllipse(r);
                        Region region2 = new Region(path2);
                        g.SetClip(region2, CombineMode.Replace);
                        g.FillRectangle(brush5, rectangle4);
                        g.SetClip(new Rectangle(0, 0, width, height));
                        path2.Dispose();
                        region2.Dispose();
                        brush5.Dispose();
                    }
                    g.SmoothingMode = SmoothingMode.None;
                }
            }
            if (base.Site != null)
            {
                this.SaveChart(this.RootPath, image);
            }
            else
            {
                this.SaveChart(HttpContext.Current.Server.MapPath(".") + @"\", image);
            }
            g.Dispose();
            image.Dispose();
        }

        private void DrawPieChart3D()
        {
            int width = (int.Parse(this.Width.ToString().Substring(0, this.Width.ToString().Length - 2)) + this.InflateRight) + this.InflateLeft;
            int height = (int.Parse(this.Height.ToString().Substring(0, this.Height.ToString().Length - 2)) + this.InflateBottom) + this.InflateTop;
            Bitmap image = new Bitmap(width, height);
            Graphics graphics = Graphics.FromImage(image);
            int x = 50 + this.InflateLeft;
            int y = 60 + this.InflateTop;
            int num5 = 100 + this.InflateRight;
            int num6 = 40 + this.InflateBottom;
            int num7 = (width - x) - num5;
            int num8 = (height - y) - num6;
            if (!this.ColorGuider.Show)
            {
                num7 += 0x62 - ((int) graphics.MeasureString(this.XLabels.UnitText, this.XLabels.UnitFont).Width);
                num5 -= 0x62;
            }
            if (!this.ChartTitle.Show)
            {
                num8 += 0x21;
                y -= 0x21;
            }
            graphics.FillRectangle(new SolidBrush(this.Background.Paper), 0, 0, width + this.InflateRight, height + this.InflateBottom);
            graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
            if (this.ShowCopyright)
            {
                graphics.DrawString(this.CopyrightText, new Font("Arial", 12f, FontStyle.Italic, GraphicsUnit.Pixel), Brushes.Gray, (float) (width - 130), 0f);
            }
            if (!this.DataBound && this.ShowErrorInfo)
            {
                this.ChartTitle.Text = "Please bind a data source with BindChartData()!";
            }
            else if (this.MinData < 0f)
            {
                this.DataBound = false;
                if (this.ShowErrorInfo)
                {
                    this.ChartTitle.Text = "PieBar can not accept value < 0";
                }
            }
            StringFormat format = new StringFormat();
            format.Alignment = StringAlignment.Far;
            format.LineAlignment = StringAlignment.Center;
            format.Alignment = StringAlignment.Center;
            if (this.ChartTitle.Show)
            {
                graphics.DrawString(this.ChartTitle.Text, this.ChartTitle.Font, new SolidBrush(this.ChartTitle.ForeColor), new Rectangle(x, -30 + this.ChartTitle.OffsetY, num7, 100), format);
            }
            if (this.DataBound)
            {
                float sum = this.GetSum(this.RawDatas[0]);
                if (sum > 0f)
                {
                    for (int j = 0; j < this.RawDatas[0].Length; j++)
                    {
                        this.IntDatas[0][j] = ((float) this.RawDatas[0][j]) / sum;
                    }
                }
                else
                {
                    for (int k = 0; k < this.RawDatas[0].Length; k++)
                    {
                        this.IntDatas[0][k] = 0f;
                    }
                }
                if ((this.AxisX != null) && this.ColorGuider.Show)
                {
                    for (int m = 0; m < this.MinCount; m++)
                    {
                        SolidBrush brush = new SolidBrush(this.BarBrushColor[m % 12]);
                        graphics.FillRectangle(brush, (x + num7) + ((int) ((width - num7) * 0.2)), (y + (14 * m)) + 4, 0x12, 8);
                        graphics.DrawRectangle(Pens.Gray, (x + num7) + ((int) ((width - num7) * 0.2)), (y + 4) + (14 * m), 0x11, 7);
                        graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
                        if ((sum > 0f) && (this.IntDatas[0][m] > 0f))
                        {
                            graphics.DrawString(this.AxisX[m], this.ColorGuider.Font, new SolidBrush(this.ColorGuider.ForeColor), (float) (((x + num7) + 0x16) + ((int) ((width - num7) * 0.2))), (float) ((y + 1) + (14 * m)));
                        }
                        else
                        {
                            graphics.DrawString(this.AxisX[m] + "(0)", this.ColorGuider.Font, new SolidBrush(this.ColorGuider.ForeColor), (float) (((x + num7) + 0x16) + ((int) ((width - num7) * 0.2))), (float) ((y + 1) + (14 * m)));
                        }
                        brush.Dispose();
                    }
                }
                graphics.SmoothingMode = SmoothingMode.AntiAlias;
                int num13 = 30;
                PointF[] tfArray = new PointF[this.IntDatas[0].Length];
                PointF[] tfArray2 = new PointF[this.IntDatas[0].Length];
                float[] numArray = new float[this.IntDatas[0].Length];
                Rectangle rect = new Rectangle(x, y, num7, num8);
                rect.Inflate((int) ((-1 * num7) * 0.1), (int) ((-1 * num8) * 0.0));
                rect.Offset((int) (((-1 * num7) * 0.1) / 2.0), 0);
                Rectangle rectangle2 = rect;
                rectangle2.Offset(0, num13);
                float num14 = rect.Left + (rect.Width / 2);
                float num15 = rect.Top + (rect.Height / 2);
                graphics.DrawEllipse(Pens.Silver, rectangle2);
                GraphicsPath path = new GraphicsPath();
                GraphicsPath path2 = new GraphicsPath();
                float startAngle = 0f;
                if (sum > 0f)
                {
                    for (int n = 0; n < this.IntDatas[0].Length; n++)
                    {
                        numArray[n] = startAngle;
                        if (this.IntDatas[0][n] > 0f)
                        {
                            path.AddArc(rect, startAngle, this.IntDatas[0][n] * 360f);
                            tfArray[n] = path.PathPoints[0];
                        }
                        else if ((n == 0) || (n == (this.IntDatas[0].Length - 1)))
                        {
                            tfArray[n] = new PointF((float) (rect.Left + rect.Width), (float) (rect.Top + (rect.Height / 2)));
                        }
                        else if (this.IntDatas[0][n + 1] > 0f)
                        {
                            path.AddArc(rect, startAngle, this.IntDatas[0][n + 1] * 360f);
                            tfArray[n] = path.PathPoints[0];
                        }
                        else
                        {
                            tfArray[n] = tfArray[n - 1];
                        }
                        startAngle += this.IntDatas[0][n] * 360f;
                        if ((numArray[n] >= 0f) && (numArray[n] <= 180f))
                        {
                            path2.AddLine(num14, num15, num14, num15 + num13);
                            path2.AddLine(num14, num15 + num13, tfArray[n].X, tfArray[n].Y + num13);
                            path2.AddLine(tfArray[n].X, tfArray[n].Y + num13, tfArray[n].X, tfArray[n].Y);
                            path2.AddLine(tfArray[n].X, tfArray[n].Y, num14, num15);
                            graphics.FillPath(new SolidBrush(Color.FromArgb(200, this.BarBrushColor[n % 12])), path2);
                            path2.Reset();
                        }
                        path.Reset();
                    }
                    startAngle = 0f;
                    for (int num18 = 0; num18 < this.IntDatas[0].Length; num18++)
                    {
                        numArray[num18] = startAngle;
                        if (this.IntDatas[0][num18] > 0f)
                        {
                            path.AddArc(rect, startAngle, (this.IntDatas[0][num18] * 360f) / 2f);
                            tfArray2[num18] = path.PathPoints[path.PathPoints.Length - 1];
                        }
                        else if ((num18 == 0) || (num18 == (this.IntDatas[0].Length - 1)))
                        {
                            tfArray2[num18] = new PointF((float) (rect.Left + rect.Width), (float) (rect.Top + (rect.Height / 2)));
                        }
                        else if (this.IntDatas[0][num18 + 1] > 0f)
                        {
                            path.AddArc(rect, startAngle, (this.IntDatas[0][num18 + 1] * 360f) / 2f);
                            tfArray2[num18] = path.PathPoints[path.PathPoints.Length - 1];
                        }
                        else
                        {
                            tfArray2[num18] = tfArray2[num18 - 1];
                        }
                        startAngle += this.IntDatas[0][num18] * 360f;
                        path.Reset();
                    }
                }
                if (sum > 0f)
                {
                    for (int num19 = 0; num19 < this.IntDatas[0].Length; num19++)
                    {
                        if (this.IntDatas[0][num19] > 0f)
                        {
                            byte alpha = 0xff;
                            if ((num19 < (this.IntDatas[0].Length - 1)) && (numArray[num19 + 1] <= 180f))
                            {
                                alpha = 200;
                            }
                            graphics.FillPie(new SolidBrush(Color.FromArgb(alpha, this.BarBrushColor[num19 % 12])), rect, numArray[num19], this.IntDatas[0][num19] * 360f);
                            if ((this.Crystal.Enable && this.Crystal.CoverFull) && (((this.IntDatas[0][num19] * 360f) > 30f) && ((this.IntDatas[0][num19] * 360f) <= 180f)))
                            {
                                if (num19 < (this.IntDatas[0].Length - 1))
                                {
                                    graphics.FillPie(new LinearGradientBrush(tfArray[num19], tfArray[num19 + 1], Color.FromArgb(0xb2, Color.White), Color.FromArgb(0x19, Color.White)), rect, numArray[num19], this.IntDatas[0][num19] * 360f);
                                }
                                else
                                {
                                    graphics.FillPie(new LinearGradientBrush(tfArray[num19], tfArray[0], Color.FromArgb(0x80, Color.White), Color.FromArgb(0, Color.White)), rect, numArray[num19], this.IntDatas[0][num19] * 360f);
                                }
                            }
                        }
                    }
                }
                else
                {
                    graphics.FillPie(new SolidBrush(Color.FromArgb(200, this.BarBrushColor[0])), rect, 0f, 360f);
                }
                if (sum > 0f)
                {
                    for (int num21 = 0; num21 < this.IntDatas[0].Length; num21++)
                    {
                        if ((this.IntDatas[0][num21] > 0f) && (numArray[num21] < 180f))
                        {
                            float left;
                            float num23;
                            float num24;
                            if (num21 < (this.IntDatas[0].Length - 1))
                            {
                                if (numArray[num21 + 1] <= 180f)
                                {
                                    left = tfArray[num21 + 1].X;
                                    num23 = tfArray[num21 + 1].Y;
                                    num24 = numArray[num21 + 1] - numArray[num21];
                                }
                                else
                                {
                                    left = rect.Left;
                                    num23 = rect.Top + (rect.Height / 2);
                                    num24 = 180f - numArray[num21];
                                }
                            }
                            else
                            {
                                left = rect.Left;
                                num23 = rect.Top + (rect.Height / 2);
                                num24 = 180f - numArray[num21];
                            }
                            path2.AddArc(rect, numArray[num21], num24);
                            path2.AddLine(left, num23, left, num23 + num13);
                            path2.AddArc(rectangle2, numArray[num21], num24);
                            path2.AddLine(tfArray[num21].X, tfArray[num21].Y + num13, tfArray[num21].X, tfArray[num21].Y);
                            graphics.FillPath(new SolidBrush(Color.FromArgb(220, this.BarBrushColor[num21 % 12])), path2);
                            path2.Reset();
                        }
                    }
                }
                else
                {
                    path2.AddArc(rect, 0f, 180f);
                    path2.AddLine(rect.X, rect.Y + (rect.Height / 2), rect.X, (rect.Y + (rect.Height / 2)) + num13);
                    path2.AddArc(rectangle2, 0f, 180f);
                    path2.AddLine((int) (rect.X + rect.Width), (int) ((rect.Y + (rect.Height / 2)) + num13), (int) (rect.X + rect.Width), (int) (rect.Y + (rect.Height / 2)));
                    graphics.FillPath(new SolidBrush(Color.FromArgb(220, this.BarBrushColor[0])), path2);
                    path2.Reset();
                }
                Point point = new Point(rect.Left, 0);
                Point point2 = new Point(rect.Left + rect.Width, 0);
                Color[] colorArray = new Color[] { Color.FromArgb(180, Color.Black), Color.FromArgb(100, Color.White), Color.FromArgb(180, Color.Black) };
                float[] numArray3 = new float[3];
                numArray3[1] = 0.7f;
                numArray3[2] = 1f;
                float[] numArray2 = numArray3;
                ColorBlend blend = new ColorBlend();
                blend.Colors = colorArray;
                blend.Positions = numArray2;
                LinearGradientBrush brush2 = new LinearGradientBrush(point, point2, Color.Red, Color.Red);
                brush2.InterpolationColors = blend;
                GraphicsPath path3 = new GraphicsPath();
                path3.AddArc(rect, 0f, 180f);
                path3.AddLine(rect.Left, rect.Top + (rect.Height / 2), rectangle2.Left, rectangle2.Top + (rectangle2.Height / 2));
                path3.AddArc(rectangle2, 0f, 180f);
                path3.AddLine((int) (rectangle2.Left + rectangle2.Width), (int) (rectangle2.Top + (rectangle2.Height / 2)), (int) (rect.Left + rect.Width), (int) (rect.Top + (rect.Height / 2)));
                graphics.FillPath(brush2, path3);
                float num25 = (rect.Left + rect.Width) + 20;
                float num26 = 0f;
                float num27 = 0f;
                float num28 = 0f;
                graphics.TextRenderingHint = TextRenderingHint.AntiAlias;
                for (int i = 0; i < this.IntDatas[0].Length; i++)
                {
                    if (this.IntDatas[0][i] > 0f)
                    {
                        float num30 = (num14 + tfArray2[i].X) / 2f;
                        float num31 = (num15 + tfArray2[i].Y) / 2f;
                        string s = "";
                        if ((this.IntDatas[0][i] * 360f) >= 20f)
                        {
                            if (this.Tips.Show)
                            {
                                s = this.AxisX[i] + "\n" + this.RawDatas[0][i].ToString() + "\n";
                            }
                            s = s + ((this.IntDatas[0][i] * 100f)).ToString("0.0") + "%";
                            graphics.DrawString(s, this.Tips.Font, new SolidBrush(this.Tips.ForeColor), (float) (num30 - 10f), (float) (num31 - 4f));
                        }
                        else
                        {
                            if (numArray[i] < 180f)
                            {
                                if (num27 == 0f)
                                {
                                    num27 = rect.Top + (rect.Height / 2);
                                }
                                else
                                {
                                    num27 += 16f;
                                    if (this.Tips.Show)
                                    {
                                        num27 += 12f;
                                    }
                                }
                                num26 = num27;
                            }
                            else
                            {
                                if (num28 == 0f)
                                {
                                    num28 = rect.Top - ((rect.Top - y) / 4);
                                }
                                else
                                {
                                    num28 += 16f;
                                    if (this.Tips.Show)
                                    {
                                        num28 += 12f;
                                    }
                                }
                                num26 = num28;
                            }
                            if (this.Tips.Show)
                            {
                                s = this.AxisX[i] + "\n" + this.RawDatas[0][i].ToString() + "  ";
                            }
                            s = s + ((this.IntDatas[0][i] * 100f)).ToString("0.0") + "%";
                            graphics.DrawString(s, this.Tips.Font, new SolidBrush(this.Tips.ForeColor), num25, num26);
                            graphics.DrawLine(Pens.Gray, num25, num26 + 6f, tfArray2[i].X, tfArray2[i].Y);
                        }
                    }
                }
                path.Dispose();
                path2.Dispose();
                graphics.DrawEllipse(Pens.Silver, rect);
            }
            if (base.Site != null)
            {
                this.SaveChart(this.RootPath, image);
            }
            else
            {
                this.SaveChart(HttpContext.Current.Server.MapPath(".") + @"\", image);
            }
            graphics.Dispose();
            image.Dispose();
        }

        private void DrawStackChart()
        {
            int num7;
            int width = (int.Parse(this.Width.ToString().Substring(0, this.Width.ToString().Length - 2)) + this.InflateRight) + this.InflateLeft;
            int height = (int.Parse(this.Height.ToString().Substring(0, this.Height.ToString().Length - 2)) + this.InflateBottom) + this.InflateTop;
            Bitmap image = new Bitmap(width, height);
            Graphics g = Graphics.FromImage(image);
            int chartLeft = 50 + this.InflateLeft;
            int chartTop = 60 + this.InflateTop;
            int num5 = 100 + this.InflateRight;
            int num6 = 40 + this.InflateBottom;
            int chartW = (width - chartLeft) - num5;
            int chartH = (height - chartTop) - num6;
            int groupSize = this.GroupSize;
            decimal[] datas = new decimal[this.MaxCount];
            if (!this.ColorGuider.Show)
            {
                chartW += 0x62 - ((int) g.MeasureString(this.XLabels.UnitText, this.XLabels.UnitFont).Width);
                num5 -= 0x62;
            }
            if (!this.YLabels.Show)
            {
                chartW += 0x30;
                chartLeft -= 0x30;
            }
            if (!this.ChartTitle.Show)
            {
                chartH += 0x21;
                chartTop -= 0x21;
            }
            if (!this.DataBound && this.ShowErrorInfo)
            {
                this.ChartTitle.Text = "Please bind a data source with BindChartData()!";
            }
            else if (this.MinData < 0f)
            {
                this.DataBound = false;
                if (this.ShowErrorInfo)
                {
                    this.ChartTitle.Text = "StackBar can not accept value < 0";
                }
            }
            if (this.DataBound)
            {
                for (int i = 0; i < this.MaxCount; i++)
                {
                    datas[i] = 0M;
                    for (int k = 0; k < groupSize; k++)
                    {
                        datas[i] += this.RawDatas[k][i];
                    }
                }
                this.MaxData = this.GetBond(this.GetMax(datas));
                if (this.MaxValueY != 0.0)
                {
                    this.MaxData = (float) this.MaxValueY;
                }
                for (int j = 0; j < this.MaxCount; j++)
                {
                    for (int m = 0; m < groupSize; m++)
                    {
                        this.IntDatas[m][j] = ((((float) this.RawDatas[m][j]) - ((float) this.MinValueY)) * chartH) / (this.MaxData - ((float) this.MinValueY));
                    }
                }
            }
            int depth = 0;
            if (this.Dimension == ChartDimensions.Chart3D)
            {
                depth = (int) (this.Depth3D * 0.85);
                this.PaintBackground3D(g, chartLeft, chartTop, chartW, chartH);
                num7 = this.Alpha3D;
            }
            else
            {
                this.PaintBackground(g, chartLeft, chartTop, chartW, chartH);
                num7 = 0xff;
            }
            if (this.DataBound)
            {
                g.TextRenderingHint = TextRenderingHint.AntiAlias;
                Pen backPen = new Pen(Color.FromArgb(0xff, 220, 220, 220));
                groupSize = this.GroupSize;
                int maxCount = this.MaxCount;
                if (maxCount > 0)
                {
                    int num17;
                    int num18;
                    if (!this.AutoBarWidth && (maxCount < 12))
                    {
                        num17 = (chartW / 4) / 0x10;
                        num18 = 5 * num17;
                    }
                    else
                    {
                        num18 = (int) (((double) (chartW / maxCount)) / 1.25);
                        num17 = (int) (num18 * 0.25);
                    }
                    for (int n = 0; n < maxCount; n++)
                    {
                        int num19 = n;
                        int barLeft = (chartLeft + (num18 * num19)) + (num17 * (num19 + 1));
                        int num24 = 0;
                        int num25 = (int) (((double) depth) / 0.85);
                        g.SmoothingMode = SmoothingMode.AntiAlias;
                        this.DrawXLine(g, backPen, num25, chartTop, chartH, barLeft + (num18 / 2), num18 + num17);
                        if (this.XLabels.Show && ((n % this.XLabels.SampleSize) == 0))
                        {
                            this.DrawXText(g, backPen, this.AxisX[n], num25, chartTop, chartH, barLeft + (num18 / 2), num18 + num17);
                        }
                        for (int num26 = 0; num26 < groupSize; num26++)
                        {
                            if (this.RawDatas[num26][n] != -0.830213M)
                            {
                                SolidBrush brush;
                                Pen pen2;
                                int barH = ((int) this.IntDatas[num26][n]) - 1;
                                int barTop = ((chartTop + chartH) - barH) - num24;
                                if ((groupSize == 1) && this.Colorful)
                                {
                                    brush = new SolidBrush(Color.FromArgb(num7, this.BarBrushColor[n % 12]));
                                }
                                else
                                {
                                    brush = new SolidBrush(Color.FromArgb(num7, this.BarBrushColor[num26 % 12]));
                                }
                                if (this.Stroke.TextureEnable)
                                {
                                    pen2 = new Pen(new HatchBrush(this.Stroke.TextureStyle, this.BarPenColor[num26 % 12], Color.Gray), (float) this.Stroke.Width);
                                }
                                else
                                {
                                    pen2 = new Pen(this.BarPenColor[num26 % 12], (float) this.Stroke.Width);
                                }
                                pen2.Alignment = PenAlignment.Inset;
                                if (this.Dimension == ChartDimensions.Chart3D)
                                {
                                    this.DrawBarBase3D(g, brush, pen2, barLeft, barTop, num18, barH, depth);
                                }
                                else
                                {
                                    this.DrawBarBase2D(g, brush, pen2, barLeft, barTop, num18, barH);
                                }
                                num24 += barH;
                                if ((this.Crystal.Enable && ((barH - (this.Crystal.Contraction * 2)) > 2)) && ((num18 - (this.Crystal.Contraction * 2)) > 2))
                                {
                                    this.DrawBarCrystal(g, barLeft, barTop, num18, barH, depth);
                                }
                                if (this.Tips.Show)
                                {
                                    this.DrawTips(g, this.RawDatas[num26][n].ToString(), barLeft - num25, barTop + num25, num18, barH, false);
                                }
                                if (this.StrBarL == "")
                                {
                                    this.StrBarL = (barLeft - depth).ToString();
                                    this.StrBarW = num18.ToString();
                                    this.StrBarT = (barTop + depth).ToString();
                                    this.StrBarH = barH.ToString();
                                    this.StrBarV = this.RawDatas[num26][n].ToString();
                                }
                                else
                                {
                                    this.StrBarL = this.StrBarL + "," + (barLeft - depth);
                                    this.StrBarW = this.StrBarW + "," + num18;
                                    this.StrBarT = this.StrBarT + "," + (barTop + depth);
                                    this.StrBarH = this.StrBarH + "," + barH;
                                    this.StrBarV = this.StrBarV + "," + this.RawDatas[num26][n];
                                }
                            }
                        }
                        barLeft += num18;
                    }
                }
                backPen.Dispose();
            }
            if (this.Dimension == ChartDimensions.Chart2D)
            {
                g.DrawRectangle(Pens.Gray, chartLeft, chartTop, chartW, chartH);
                g.DrawLine(Pens.Black, (int) (chartLeft - 4), (int) ((chartTop + chartH) - 1), (int) ((chartLeft + chartW) - 1), (int) ((chartTop + chartH) - 1));
                g.DrawLine(Pens.Black, chartLeft, chartTop, chartLeft, (chartTop + chartH) + 2);
            }
            this.DrawAxisUnit(g, chartLeft, chartTop, chartW, chartH);
            if (base.Site != null)
            {
                this.SaveChart(this.RootPath, image);
            }
            else
            {
                this.SaveChart(HttpContext.Current.Server.MapPath(".") + @"\", image);
            }
            g.Dispose();
            image.Dispose();
        }

        private void DrawTips(Graphics g, string tip, int BarLeft, int BarTop, int BarW, int BarH, bool BelowX)
        {
            float num;
            if (BelowX)
            {
                BarTop = (BarTop + BarH) + 15;
            }
            SizeF ef = g.MeasureString(tip, this.Tips.Font);
            if (BarW >= ef.Width)
            {
                num = BarLeft + ((BarW - ef.Width) / 2f);
            }
            else
            {
                num = (BarLeft + BarW) - ef.Width;
            }
            StringFormat format = new StringFormat();
            format.Alignment = StringAlignment.Center;
            if (this.ChartType == ChartTypes.Stack)
            {
                g.DrawString(tip.ToString(), this.Tips.Font, new SolidBrush(this.Tips.ForeColor), new RectangleF(num, (float) BarTop, ef.Width, ef.Height), format);
            }
            else
            {
                g.DrawString(tip.ToString(), this.Tips.Font, new SolidBrush(this.Tips.ForeColor), new RectangleF(num, (float) (BarTop - 14), ef.Width, ef.Height), format);
            }
            format.Dispose();
        }

        private void DrawXLine(Graphics g, Pen BackPen, int DP3, int ChartTop, int ChartH, int XPos, int XWidth)
        {
            g.SmoothingMode = SmoothingMode.AntiAlias;
            g.DrawLine(BackPen, XPos, ChartTop + ChartH, XPos, ChartTop);
            g.DrawLine(BackPen, XPos - DP3, (ChartTop + ChartH) + DP3, XPos, ChartTop + ChartH);
            g.SmoothingMode = SmoothingMode.None;
            g.DrawLine(Pens.Black, (int) (XPos - DP3), (int) (((ChartTop + ChartH) - 1) + DP3), (int) (XPos - DP3), (int) (((ChartTop + ChartH) + 2) + DP3));
        }

        private void DrawXText(Graphics g, Pen BackPen, string XText, int DP3, int ChartTop, int ChartH, int XPos, int XWidth)
        {
            StringFormat format = new StringFormat();
            g.TextRenderingHint = TextRenderingHint.AntiAlias;
            if (this.XLabels.RotateAngle > 0f)
            {
                format.Alignment = StringAlignment.Near;
                g.TranslateTransform((float) (XPos - DP3), (float) (((ChartTop + ChartH) + 1) + DP3));
                g.RotateTransform(this.XLabels.RotateAngle);
                g.DrawString(XText, this.XLabels.Font, new SolidBrush(this.XLabels.ForeColor), 0f, 0f, format);
                g.ResetTransform();
            }
            else
            {
                format.Alignment = StringAlignment.Center;
                g.DrawString(XText, this.XLabels.Font, new SolidBrush(this.XLabels.ForeColor), new Rectangle((XPos - (XWidth / 2)) - DP3, ((ChartTop + DP3) + ChartH) + 1, XWidth + 1, (int) g.MeasureString(XText, this.XLabels.Font).Width), format);
            }
            format.Dispose();
        }

        private void DrawYLine(Graphics g, Pen BackPen, string Text, int DP3, int ChartLeft, int ChartTop, int ChartW, int YPos, int YHeight)
        {
            StringFormat format = new StringFormat();
            g.TextRenderingHint = TextRenderingHint.AntiAlias;
            g.DrawLine(new Pen(Color.FromArgb(0xff, 220, 220, 220)), ChartLeft, YPos, ChartLeft + ChartW, YPos);
            g.DrawLine(Pens.Black, ChartLeft - 3, YPos, ChartLeft, YPos);
            if (this.YLabels.Show)
            {
                g.DrawString(Text, this.YLabels.Font, new SolidBrush(this.YLabels.ForeColor), new Rectangle(0, YPos - 10, ChartLeft - 4, 20), format);
            }
            format.Dispose();
        }

        private float GetBond(float DataIn)
        {
            int num = (int) Math.Floor((double) (DataIn / 10f));
            if (num <= 0)
            {
                return DataIn;
            }
            if ((DataIn - (num * 10)) > 5f)
            {
                num = (num + 1) * 10;
            }
            else if (((DataIn - (num * 10)) < 5f) && ((DataIn - (num * 10)) > 0f))
            {
                num = (num * 10) + 5;
            }
            else
            {
                num = (int) DataIn;
            }
            return (float) num;
        }

        private float GetMax(decimal[] Datas)
        {
            float num = 0f;
            for (int i = 0; i < Datas.Length; i++)
            {
                if (((float) Datas[i]) > num)
                {
                    num = (float) Datas[i];
                }
            }
            return num;
        }

        private float GetMax(float[] Datas)
        {
            float num = 0f;
            for (int i = 0; i < Datas.Length; i++)
            {
                if (Datas[i] > num)
                {
                    num = Datas[i];
                }
            }
            return num;
        }

        private float GetMin(decimal[] Datas)
        {
            float num = (float) Datas[0];
            for (int i = 0; i < Datas.Length; i++)
            {
                if (((float) Datas[i]) < num)
                {
                    num = (float) Datas[i];
                }
            }
            return num;
        }

        private float GetMin(float[] Datas)
        {
            float num = Datas[0];
            for (int i = 0; i < Datas.Length; i++)
            {
                if (Datas[i] < num)
                {
                    num = Datas[i];
                }
            }
            return num;
        }

        public GraphicsPath GetRoundRect(Rectangle r, float roundRadius, bool halfRound)
        {
            float left = r.Left;
            float top = r.Top;
            float width = r.Width;
            float height = r.Height;
            GraphicsPath path = new GraphicsPath();
            path.AddArc(left, top, roundRadius * 2f, roundRadius * 2f, 180f, 90f);
            path.AddLine(left + roundRadius, top, (left + width) - roundRadius, top);
            path.AddArc((left + width) - (roundRadius * 2f), top, roundRadius * 2f, roundRadius * 2f, 270f, 90f);
            if (halfRound)
            {
                path.AddLine((float) (left + width), (float) (top + roundRadius), (float) (left + width), (float) (top + height));
                path.AddLine(left + width, top + height, left, top + height);
                path.AddLine(left, top + height, left, top + roundRadius);
                return path;
            }
            path.AddLine((float) (left + width), (float) (top + roundRadius), (float) (left + width), (float) ((top + height) - roundRadius));
            path.AddArc((float) ((left + width) - (roundRadius * 2f)), (float) ((top + height) - (2f * roundRadius)), (float) (roundRadius * 2f), (float) (roundRadius * 2f), 0f, 90f);
            path.AddLine((float) (left + roundRadius), (float) (top + height), (float) ((left + width) - roundRadius), (float) (top + height));
            path.AddArc(left, (top + height) - (2f * roundRadius), roundRadius * 2f, roundRadius * 2f, 90f, 90f);
            path.AddLine(left, top + roundRadius, left, (top + height) - roundRadius);
            return path;
        }

        public GraphicsPath GetRoundRect(float x, float y, float width, float height, float roundRadius, bool halfRound)
        {
            GraphicsPath path = new GraphicsPath();
            path.AddArc(x, y, roundRadius * 2f, roundRadius * 2f, 180f, 90f);
            path.AddLine(x + roundRadius, y, (x + width) - roundRadius, y);
            path.AddArc((x + width) - (roundRadius * 2f), y, roundRadius * 2f, roundRadius * 2f, 270f, 90f);
            if (halfRound)
            {
                path.AddLine((float) (x + width), (float) (y + roundRadius), (float) (x + width), (float) (y + height));
                path.AddLine(x + width, y + height, x, y + height);
                path.AddLine(x, y + height, x, y + roundRadius);
                return path;
            }
            path.AddLine((float) (x + width), (float) (y + roundRadius), (float) (x + width), (float) ((y + height) - roundRadius));
            path.AddArc((float) ((x + width) - (roundRadius * 2f)), (float) ((y + height) - (2f * roundRadius)), (float) (roundRadius * 2f), (float) (roundRadius * 2f), 0f, 90f);
            path.AddLine((float) (x + roundRadius), (float) (y + height), (float) ((x + width) - roundRadius), (float) (y + height));
            path.AddArc(x, (y + height) - (2f * roundRadius), roundRadius * 2f, roundRadius * 2f, 90f, 90f);
            path.AddLine(x, y + roundRadius, x, (y + height) - roundRadius);
            return path;
        }

        public GraphicsPath GetRoundRect(float x, float y, float width, float height, float roundRadius, string action)
        {
            GraphicsPath path = new GraphicsPath();
            path.AddArc(x, y, roundRadius * 2f, roundRadius * 2f, 180f, 90f);
            if (action == "Quad")
            {
                path.AddLine(x + roundRadius, y, x + width, y);
                path.AddLine(x + width, y, x + width, y + height);
            }
            else
            {
                path.AddLine(x + roundRadius, y, (x + width) - roundRadius, y);
                path.AddArc((x + width) - (roundRadius * 2f), y, roundRadius * 2f, roundRadius * 2f, 270f, 90f);
            }
            if ((action == "Half") || (action == "Quad"))
            {
                path.AddLine((float) (x + width), (float) (y + roundRadius), (float) (x + width), (float) (y + height));
                path.AddLine(x + width, y + height, x, y + height);
                path.AddLine(x, y + height, x, y + roundRadius);
                return path;
            }
            path.AddLine((float) (x + width), (float) (y + roundRadius), (float) (x + width), (float) ((y + height) - roundRadius));
            path.AddArc((float) ((x + width) - (roundRadius * 2f)), (float) ((y + height) - (2f * roundRadius)), (float) (roundRadius * 2f), (float) (roundRadius * 2f), 0f, 90f);
            path.AddLine((float) (x + roundRadius), (float) (y + height), (float) ((x + width) - roundRadius), (float) (y + height));
            path.AddArc(x, (y + height) - (2f * roundRadius), roundRadius * 2f, roundRadius * 2f, 90f, 90f);
            path.AddLine(x, y + roundRadius, x, (y + height) - roundRadius);
            return path;
        }

        private float GetSum(decimal[] Datas)
        {
            float num = 0f;
            for (int i = 0; i < Datas.Length; i++)
            {
                num += (float) Datas[i];
            }
            return num;
        }

        private float GetSum(float[] Datas)
        {
            float num = 0f;
            for (int i = 0; i < Datas.Length; i++)
            {
                num += Datas[i];
            }
            return num;
        }

        public string GetVersion()
        {
            string str = "Product Name: Chartlet<br>Description: Smart Chart Control For .NET<br>";
            return ((str + "Version: v0.97 (29/4/2009 - 16/02/2010)<br>" + "Copyright \x00a9 <font style='color:purple; font-weight:bold'>FanG</font> Corporation &nbsp;&nbsp;Powered by <font style='color:purple;'>Alay(阿赖)</font><br>") + "Home Page:http://www.chartlet.cn<br>" + "Contact: FanG2008.Zhao@gmail.com");
        }

        public string GetVersionDetail()
        {
            string str = null;
            return ((((((((str + "Version: v0.97 (16/02/2010) In this version HBar chart is provided and add baseline property to display bar/line below X Axis.<br>" + "Version: v0.96 (30/12/2009) In this version fixed the Chart Left,Right,Top,Bottom blank space,and the blank space will be replaced by chart when Title/ColorGuider/YLabels is hidden.X labels will be align center when not rotated.<br>") + "Version: v0.95 (15/10/2009) In this version we create the onmouseover-tips-show effect with JS.<br>" + "Version: v0.94 (15/9/2009) In this version we reorganized attributes of Chart and put some attributes into composite attributes and provide Font,Color control for all text on chart.<br>") + "Version: v0.93 (13/9/2009) In this version eleminate Out Of Memery bug and.Stack Bar Chart in 2D and 3D is available<br>" + "Version: v0.92 (19/8/2009) In this version eleminate out of index bug when pie chart data is all zero and add color guider controls,add Tips.Show control for 2D Pie chart.Add error msg for no-bond chart<br>") + "Version: v0.91 (19/8/2009) In this version Chartlet can accept DataSet,DataTable,DataView and SqlDataSource as data source.<br>" + "Version: v0.9 (7/7/2009) In this version 3D Bar chart and 3D Line Chart is available,provide Tips.Show attribute to show values beside every element.<br>") + "Version: v0.8 (7/6/2009) In this version 3D pie chart is available,provide MinValueY attribute for you to define the Y Axis and removed text displaying in 2D pie chart,correct out of index error.<br>" + "Version: v0.7 (29/5/2009) In this version Crystal effect is available for Pie Chart, add white border and texture border effect.<br>") + "Version: v0.6 (25/5/2009) In this version Crystal effect is available for Bar Chart, and embed 3 groups of pretty color, you can create pretty crystal chart easily with it,and enclosed some beautiful chart setting, you can create pretty chart only with one setting!<br>" + "Version: v0.5 (21/5/2009) In this version Pie - Chart and Chartlet - Help is available.<br>") + "Version: v0.4 (16/5/2009) In this version BindChartData() method was provided, you can bind SqlDataSource to Chartlet Control directly, and InitializeData() method stil  provided as a alternative choice.<br>" + "Version: v0.3 (10/5/2009) In this version Line Chart is available,inherit flexible color setting and shadow setting, provide line connection setting.<br>") + "Version: v0.2 (3/5/2009) In this version glorious Bar Chart is available, provide color setting, flexible shadow setting and round rectangle setting.<br>" + "Version: v0.1 (29/4/2009) In this version basic Bar Chart is available.<br>");
        }

        public void InitializeData(ArrayList[] ChartData, ArrayList XLabel, ArrayList ColorGuider)
        {
            switch (this.Fill.ColorStyle)
            {
                case ColorStyles.Breeze:
                    this.Breeze.CopyTo(this.BarBrushColor, 0);
                    break;

                case ColorStyles.Aurora:
                    this.Aurora.CopyTo(this.BarBrushColor, 0);
                    break;

                case ColorStyles.StarryNight:
                    this.StarryNight.CopyTo(this.BarBrushColor, 0);
                    break;
            }
            switch (this.Stroke.ColorStyle)
            {
                case ColorStyles.Breeze:
                    this.Breeze.CopyTo(this.BarPenColor, 0);
                    break;

                case ColorStyles.Aurora:
                    this.Aurora.CopyTo(this.BarPenColor, 0);
                    break;

                case ColorStyles.StarryNight:
                    this.StarryNight.CopyTo(this.BarPenColor, 0);
                    break;
            }
            if (!this.Fill.Color1.IsEmpty)
            {
                this.BarBrushColor[0] = this.Fill.Color1;
            }
            if (!this.Fill.Color2.IsEmpty)
            {
                this.BarBrushColor[1] = this.Fill.Color2;
            }
            if (!this.Fill.Color3.IsEmpty)
            {
                this.BarBrushColor[2] = this.Fill.Color3;
            }
            if (!this.Stroke.Color1.IsEmpty)
            {
                this.BarPenColor[0] = this.Stroke.Color1;
            }
            if (!this.Stroke.Color2.IsEmpty)
            {
                this.BarPenColor[1] = this.Stroke.Color2;
            }
            if (!this.Stroke.Color3.IsEmpty)
            {
                this.BarPenColor[2] = this.Stroke.Color3;
            }
            int num = int.Parse(this.Height.ToString().Substring(0, this.Height.ToString().Length - 2));
            int num2 = 60;
            int num3 = 40;
            int num4 = (num - num2) - num3;
            if (!this.ChartTitle.Show)
            {
                num4 += num2 - 0x1b;
                num2 = 0x1b;
            }
            if (base.Site != null)
            {
                this.RawDatas = new decimal[3][];
                if (this.GroupSize == 0)
                {
                    this.GroupSize = 3;
                }
                this.RawDatas[0] = new decimal[] { 75M, 61M, 75M, 90M };
                this.RawDatas[1] = new decimal[] { 98M, 21M, 65M, 48M };
                this.RawDatas[2] = new decimal[] { 61M, 98M, 32M, 66M };
                this.MaxCount = (int) this.GetMax(new float[] { (float) this.RawDatas[0].Length, (float) this.RawDatas[0].Length, (float) this.RawDatas[0].Length });
                this.MinCount = this.MaxCount;
                this.AxisX = new string[this.MaxCount];
                for (int k = 0; k < this.MaxCount; k++)
                {
                    this.AxisX[k] = (k + 1).ToString();
                }
                this.XLabels.UnitText = "Month";
                this.YLabels.UnitText = "%";
                this.GroupTitle = new string[this.GroupSize];
                for (int m = 0; m < this.GroupSize; m++)
                {
                    this.GroupTitle[m] = "Sales" + m.ToString();
                }
            }
            else if (ChartData != null)
            {
                int length = ChartData.Length;
                if ((this.GroupSize == 0) || (this.GroupSize > length))
                {
                    this.GroupSize = length;
                }
                float[] numArray = new float[length];
                for (int n = 0; n < length; n++)
                {
                    numArray[n] = ChartData[n].Count;
                }
                this.MaxCount = (int) this.GetMax(numArray);
                this.MinCount = (int) this.GetMin(numArray);
                this.RawDatas = new decimal[length][];
                for (int num9 = 0; num9 < length; num9++)
                {
                    this.RawDatas[num9] = new decimal[this.MaxCount];
                    for (int num10 = 0; num10 < this.MaxCount; num10++)
                    {
                        if (ChartData[num9] != null)
                        {
                            try
                            {
                                this.RawDatas[num9][num10] = decimal.Parse(ChartData[num9][num10].ToString());
                            }
                            catch (Exception)
                            {
                                this.RawDatas[num9][num10] = -0.830213M;
                            }
                        }
                        else
                        {
                            this.RawDatas[num9][num10] = -0.830213M;
                        }
                    }
                }
                this.AxisX = new string[this.MaxCount];
                if (XLabel != null)
                {
                    for (int num11 = 0; num11 < this.MaxCount; num11++)
                    {
                        if (num11 >= XLabel.Count)
                        {
                            this.AxisX[num11] = "null";
                        }
                        else
                        {
                            this.AxisX[num11] = XLabel[num11].ToString();
                        }
                    }
                }
                else
                {
                    for (int num12 = 0; num12 < this.MaxCount; num12++)
                    {
                        this.AxisX[num12] = (num12 + 1).ToString();
                    }
                }
                if (ColorGuider != null)
                {
                    this.GroupTitle = new string[this.GroupSize];
                    for (int num13 = 0; num13 < this.GroupSize; num13++)
                    {
                        if (num13 >= ColorGuider.Count)
                        {
                            this.GroupTitle[num13] = "null";
                        }
                        else
                        {
                            this.GroupTitle[num13] = ColorGuider[num13].ToString();
                        }
                    }
                }
            }
            if (this.MaxValueY != 0.0)
            {
                this.MaxData = (float) this.MaxValueY;
            }
            else
            {
                int num14 = this.GroupSize;
                float[] numArray2 = new float[num14];
                for (int num15 = 0; num15 < num14; num15++)
                {
                    numArray2[num15] = this.GetMax(this.RawDatas[num15]);
                }
                this.MaxData = this.GetMax(numArray2);
                this.MaxData = this.GetBond(this.MaxData);
            }
            if (this.MaxData == 0f)
            {
                this.MaxData = 1f;
            }
            int groupSize = this.GroupSize;
            float[] datas = new float[groupSize];
            for (int i = 0; i < groupSize; i++)
            {
                datas[i] = this.GetMin(this.RawDatas[i]);
            }
            this.MinData = this.GetMin(datas);
            this.MinData = this.GetBond(this.MinData);
            if ((this.MinValueY != 0.0) || (this.MinValueY < this.MinData))
            {
                this.MinData = (float) this.MinValueY;
            }
            if (this.BaseLineX == -0.830213)
            {
                this.BaseLineX = this.MinData;
            }
            this.BaseLineXInt = ((((float) this.BaseLineX) - this.MinData) * num4) / (this.MaxData - this.MinData);
            this.IntDatas = new float[this.RawDatas.Length][];
            for (int j = 0; j < this.RawDatas.Length; j++)
            {
                this.IntDatas[j] = new float[this.RawDatas[j].Length];
                for (int num19 = 0; num19 < this.RawDatas[j].Length; num19++)
                {
                    this.IntDatas[j][num19] = ((((float) this.RawDatas[j][num19]) - this.MinData) * num4) / (this.MaxData - this.MinData);
                }
            }
            if ((this.MaxCount == 0) && this.ShowErrorInfo)
            {
                this.ChartTitle.Text = "No Data Found!";
            }
            this.DataBound = true;
            this.ShiftColor(this.Fill.ShiftStep, "Fill");
            this.ShiftColor(this.Stroke.ShiftStep, "Stroke");
        }

        private void PaintBackground(Graphics g, int ChartLeft, int ChartTop, int ChartW, int ChartH)
        {
            int num = int.Parse(this.Width.ToString().Substring(0, this.Width.ToString().Length - 2));
            int num2 = int.Parse(this.Height.ToString().Substring(0, this.Height.ToString().Length - 2));
            g.FillRectangle(new SolidBrush(this.Background.Paper), 0, 0, (num + this.InflateRight) + this.InflateLeft, (num2 + this.InflateBottom) + this.InflateTop);
            g.TextRenderingHint = TextRenderingHint.AntiAlias;
            if (this.ShowCopyright)
            {
                g.DrawString(this.CopyrightText, new Font("Arial", 12f, FontStyle.Italic, GraphicsUnit.Pixel), Brushes.Gray, (float) (num - 130), 0f);
            }
            Color highlight = this.Background.Highlight;
            Color lowlight = this.Background.Lowlight;
            StringFormat format = new StringFormat();
            format.Alignment = StringAlignment.Far;
            format.LineAlignment = StringAlignment.Center;
            if (this.ChartType != ChartTypes.HBar)
            {
                g.FillRectangle(new SolidBrush(highlight), ChartLeft, ChartTop, ChartW, ChartH / 5);
                g.FillRectangle(new SolidBrush(highlight), ChartLeft, ChartTop + ((ChartH * 2) / 5), ChartW, ChartH / 5);
                g.FillRectangle(new SolidBrush(highlight), ChartLeft, ChartTop + ((ChartH * 4) / 5), ChartW, ChartH / 5);
                g.DrawRectangle(new Pen(lowlight), ChartLeft, ChartTop + ((ChartH * 2) / 5), ChartW - 1, (ChartH / 5) - 1);
                g.DrawRectangle(new Pen(lowlight), ChartLeft, ChartTop, ChartW - 1, (ChartH / 5) - 1);
                g.DrawRectangle(new Pen(lowlight), ChartLeft, ChartTop + ((ChartH * 4) / 5), ChartW - 1, (ChartH / 5) - 1);
                for (int i = 0; i <= 5; i++)
                {
                    if (this.YLabels.Show)
                    {
                        g.DrawString((this.MinData + (((this.MaxData - this.MinData) * (5 - i)) / 5f)).ToString(this.YLabels.ValueFormat), this.YLabels.Font, new SolidBrush(this.YLabels.ForeColor), new Rectangle(0, (ChartTop + ((ChartH * i) / 5)) - 10, ChartLeft - 4, 20), format);
                    }
                    if (i > 0)
                    {
                        g.DrawLine(Pens.Black, ChartLeft - 3, ChartTop + ((ChartH * i) / 5), ChartLeft, ChartTop + ((ChartH * i) / 5));
                    }
                }
            }
            if (this.ChartTitle.Show)
            {
                format.Alignment = StringAlignment.Center;
                g.DrawString(this.ChartTitle.Text, this.ChartTitle.Font, new SolidBrush(this.ChartTitle.ForeColor), new Rectangle(ChartLeft, ((ChartTop - 2) - ((int) g.MeasureString(this.ChartTitle.Text, this.ChartTitle.Font).Height)) + this.ChartTitle.OffsetY, ChartW, (int) g.MeasureString(this.ChartTitle.Text, this.ChartTitle.Font).Height), format);
            }
            if ((this.GroupTitle != null) && this.ColorGuider.Show)
            {
                for (int j = 0; j < this.GroupSize; j++)
                {
                    SolidBrush brush;
                    switch (this.ChartType)
                    {
                        case ChartTypes.Bar:
                            brush = new SolidBrush(this.BarBrushColor[j % 12]);
                            break;

                        case ChartTypes.Line:
                            brush = new SolidBrush(this.BarPenColor[j % 12]);
                            break;

                        default:
                            brush = new SolidBrush(this.BarBrushColor[j % 12]);
                            break;
                    }
                    switch (this.ChartType)
                    {
                        case ChartTypes.Bar:
                            g.FillRectangle(brush, (ChartLeft + ChartW) + 6, (ChartTop + (14 * j)) + 4, 0x12, 8);
                            g.DrawRectangle(Pens.Gray, (ChartLeft + ChartW) + 6, (ChartTop + 4) + (14 * j), 0x11, 7);
                            goto Label_04D3;

                        case ChartTypes.Line:
                            g.DrawLine(new Pen(brush), (int) ((ChartLeft + ChartW) + 6), (int) ((ChartTop + (14 * j)) + 8), (int) ((ChartLeft + ChartW) + 0x18), (int) ((ChartTop + (14 * j)) + 8));
                            if (this.LineConnectionType != LineConnectionTypes.Square)
                            {
                                break;
                            }
                            g.FillRectangle(brush, (ChartLeft + ChartW) + 11, (ChartTop + (14 * j)) + 4, 8, 8);
                            goto Label_04D3;

                        default:
                            g.FillRectangle(brush, (ChartLeft + ChartW) + 6, (ChartTop + (14 * j)) + 4, 0x12, 8);
                            g.DrawRectangle(Pens.Gray, (ChartLeft + ChartW) + 6, (ChartTop + 4) + (14 * j), 0x11, 7);
                            goto Label_04D3;
                    }
                    if (this.LineConnectionType == LineConnectionTypes.Round)
                    {
                        g.SmoothingMode = SmoothingMode.AntiAlias;
                        g.FillEllipse(brush, (ChartLeft + ChartW) + 11, (ChartTop + (14 * j)) + 4, 8, 8);
                    }
                Label_04D3:
                    g.TextRenderingHint = TextRenderingHint.AntiAlias;
                    g.DrawString(this.GroupTitle[j], this.ColorGuider.Font, new SolidBrush(this.ColorGuider.ForeColor), (float) ((ChartLeft + ChartW) + 0x1c), (float) ((ChartTop + 1) + (14 * j)));
                    brush.Dispose();
                }
            }
            format.Dispose();
        }

        private void PaintBackground3D(Graphics g, int ChartLeft, int ChartTop, int ChartW, int ChartH)
        {
            int num = int.Parse(this.Width.ToString().Substring(0, this.Width.ToString().Length - 2));
            int num2 = int.Parse(this.Height.ToString().Substring(0, this.Height.ToString().Length - 2));
            g.FillRectangle(new SolidBrush(this.Background.Paper), 0, 0, (num + this.InflateRight) + this.InflateLeft, (num2 + this.InflateBottom) + this.InflateTop);
            g.TextRenderingHint = TextRenderingHint.AntiAlias;
            if (this.ShowCopyright)
            {
                g.DrawString(this.CopyrightText, new Font("Arial", 12f, FontStyle.Italic, GraphicsUnit.Pixel), Brushes.Gray, (float) (num - 130), 0f);
            }
            Rectangle rect = new Rectangle(ChartLeft, ChartTop, ChartW, ChartH);
            Rectangle rectangle2 = rect;
            int y = this.Depth3D;
            rectangle2.Offset(-y, y);
            SolidBrush brush = new SolidBrush(this.Background.Highlight);
            Pen pen = new Pen(this.Background.Lowlight);
            GraphicsPath path = new GraphicsPath();
            path.Reset();
            Color.FromArgb(80, 0xee, 0xed, 0xee);
            Color.FromArgb(0xff, 220, 220, 220);
            StringFormat format = new StringFormat();
            format.Alignment = StringAlignment.Far;
            format.LineAlignment = StringAlignment.Center;
            if (this.ChartType != ChartTypes.HBar)
            {
                g.FillRectangle(brush, ChartLeft, ChartTop, ChartW, ChartH / 5);
                g.DrawRectangle(pen, ChartLeft, ChartTop, ChartW, ChartH / 5);
                path.StartFigure();
                path.AddLine(ChartLeft, ChartTop, ChartLeft - y, ChartTop + y);
                path.AddLine((int) (ChartLeft - y), (int) (ChartTop + y), (int) (ChartLeft - y), (int) ((ChartTop + y) + (ChartH / 5)));
                path.AddLine(ChartLeft - y, (ChartTop + y) + (ChartH / 5), ChartLeft, ChartTop + (ChartH / 5));
                path.AddLine(ChartLeft, ChartTop + (ChartH / 5), ChartLeft, ChartTop);
                g.FillRectangle(brush, ChartLeft, ChartTop + ((ChartH * 2) / 5), ChartW, ChartH / 5);
                g.DrawRectangle(pen, ChartLeft, ChartTop + ((ChartH * 2) / 5), ChartW, ChartH / 5);
                path.StartFigure();
                path.AddLine(ChartLeft, ChartTop + ((ChartH * 2) / 5), ChartLeft - y, (ChartTop + ((ChartH * 2) / 5)) + y);
                path.AddLine((int) (ChartLeft - y), (int) ((ChartTop + ((ChartH * 2) / 5)) + y), (int) (ChartLeft - y), (int) (((ChartTop + ((ChartH * 2) / 5)) + y) + (ChartH / 5)));
                path.AddLine(ChartLeft - y, ((ChartTop + ((ChartH * 2) / 5)) + y) + (ChartH / 5), ChartLeft, (ChartTop + ((ChartH * 2) / 5)) + (ChartH / 5));
                path.AddLine(ChartLeft, (ChartTop + ((ChartH * 2) / 5)) + (ChartH / 5), ChartLeft, ChartTop + ((ChartH * 2) / 5));
                g.FillRectangle(brush, ChartLeft, ChartTop + ((ChartH * 4) / 5), ChartW, ChartH / 5);
                g.DrawRectangle(pen, ChartLeft, ChartTop + ((ChartH * 4) / 5), ChartW, ChartH / 5);
                path.StartFigure();
                path.AddLine(ChartLeft, ChartTop + ((ChartH * 4) / 5), ChartLeft - y, (ChartTop + ((ChartH * 4) / 5)) + y);
                path.AddLine((int) (ChartLeft - y), (int) ((ChartTop + ((ChartH * 4) / 5)) + y), (int) (ChartLeft - y), (int) (((ChartTop + ((ChartH * 4) / 5)) + y) + (ChartH / 5)));
                path.AddLine(ChartLeft - y, ((ChartTop + ((ChartH * 4) / 5)) + y) + (ChartH / 5), ChartLeft, (ChartTop + ((ChartH * 4) / 5)) + (ChartH / 5));
                path.AddLine(ChartLeft, (ChartTop + ((ChartH * 4) / 5)) + (ChartH / 5), ChartLeft, ChartTop + ((ChartH * 4) / 5));
                g.FillPath(brush, path);
                g.DrawPath(pen, path);
                for (int i = 0; i <= 5; i++)
                {
                    if (this.YLabels.Show)
                    {
                        g.DrawString((this.MinValueY + (((this.MaxData - this.MinValueY) * (5 - i)) / 5.0)).ToString(this.YLabels.ValueFormat), this.YLabels.Font, new SolidBrush(this.YLabels.ForeColor), new Rectangle(-y, ((ChartTop + ((ChartH * i) / 5)) - 10) + y, ChartLeft - 4, 20), format);
                    }
                    g.DrawLine(Pens.Black, rectangle2.Left - 3, rectangle2.Top + ((ChartH * i) / 5), rectangle2.Left, rectangle2.Top + ((ChartH * i) / 5));
                }
            }
            if (this.ChartTitle.Show)
            {
                format.Alignment = StringAlignment.Center;
                g.DrawString(this.ChartTitle.Text, this.ChartTitle.Font, new SolidBrush(this.ChartTitle.ForeColor), new Rectangle(ChartLeft, ((ChartTop - 2) - ((int) g.MeasureString(this.ChartTitle.Text, this.ChartTitle.Font).Height)) + this.ChartTitle.OffsetY, ChartW, (int) g.MeasureString(this.ChartTitle.Text, this.ChartTitle.Font).Height), format);
            }
            if ((this.GroupTitle != null) && this.ColorGuider.Show)
            {
                for (int j = 0; j < this.GroupSize; j++)
                {
                    SolidBrush brush2;
                    switch (this.ChartType)
                    {
                        case ChartTypes.Bar:
                            brush2 = new SolidBrush(this.BarBrushColor[j % 12]);
                            break;

                        case ChartTypes.Line:
                            brush2 = new SolidBrush(this.BarPenColor[j % 12]);
                            break;

                        default:
                            brush2 = new SolidBrush(this.BarBrushColor[j % 12]);
                            break;
                    }
                    switch (this.ChartType)
                    {
                        case ChartTypes.Bar:
                            g.FillRectangle(brush2, (ChartLeft + ChartW) + 6, (ChartTop + (14 * j)) + 4, 0x12, 8);
                            g.DrawRectangle(Pens.Gray, (ChartLeft + ChartW) + 6, (ChartTop + 4) + (14 * j), 0x11, 7);
                            goto Label_06DB;

                        case ChartTypes.Line:
                            g.DrawLine(new Pen(brush2), (int) ((ChartLeft + ChartW) + 6), (int) ((ChartTop + (14 * j)) + 8), (int) ((ChartLeft + ChartW) + 0x18), (int) ((ChartTop + (14 * j)) + 8));
                            if (this.LineConnectionType != LineConnectionTypes.Square)
                            {
                                break;
                            }
                            g.FillRectangle(brush2, (ChartLeft + ChartW) + 11, (ChartTop + (14 * j)) + 4, 8, 8);
                            goto Label_06DB;

                        default:
                            g.FillRectangle(brush2, (ChartLeft + ChartW) + 6, (ChartTop + (14 * j)) + 4, 0x12, 8);
                            g.DrawRectangle(Pens.Gray, (ChartLeft + ChartW) + 6, (ChartTop + 4) + (14 * j), 0x11, 7);
                            goto Label_06DB;
                    }
                    if (this.LineConnectionType == LineConnectionTypes.Round)
                    {
                        g.SmoothingMode = SmoothingMode.AntiAlias;
                        g.FillEllipse(brush2, (ChartLeft + ChartW) + 11, (ChartTop + (14 * j)) + 4, 8, 8);
                    }
                Label_06DB:
                    g.TextRenderingHint = TextRenderingHint.AntiAlias;
                    g.DrawString(this.GroupTitle[j], this.ColorGuider.Font, new SolidBrush(this.ColorGuider.ForeColor), (float) ((ChartLeft + ChartW) + 0x1c), (float) ((ChartTop + 1) + (14 * j)));
                    brush2.Dispose();
                }
            }
            format.Dispose();
            g.DrawRectangle(Pens.Gray, rect);
            path.Reset();
            path.StartFigure();
            path.AddLine(rect.Left, rect.Top, rectangle2.Left, rectangle2.Top);
            path.AddLine(rectangle2.Left, rectangle2.Top, rectangle2.Left, rectangle2.Top + rectangle2.Height);
            path.AddLine(rectangle2.Left, rectangle2.Top + rectangle2.Height, rect.Left, rect.Top + rect.Height);
            path.AddLine(rect.Left, rect.Top + rect.Height, rect.Left, rect.Top);
            path.StartFigure();
            path.AddLine(rect.Left, rect.Top + rect.Height, rectangle2.Left, rectangle2.Top + rectangle2.Height);
            path.AddLine(rectangle2.Left, rectangle2.Top + rectangle2.Height, rectangle2.Left + rectangle2.Width, rectangle2.Top + rectangle2.Height);
            path.AddLine((int) (rectangle2.Left + rectangle2.Width), (int) (rectangle2.Top + rectangle2.Height), (int) (rect.Left + rect.Width), (int) (rect.Top + rect.Height));
            path.AddLine(rect.Left + rect.Width, rect.Top + rect.Height, rect.Left, rect.Top + rect.Height);
            g.DrawPath(Pens.Gray, path);
            path.Dispose();
            brush.Dispose();
            pen.Dispose();
        }

        protected override void Render(HtmlTextWriter writer)
        {
            if (base.Site != null)
            {
                this.InitializeData(null, null, null);
            }
            switch (this.ChartType)
            {
                case ChartTypes.Bar:
                    this.DrawBarsChart();
                    break;

                case ChartTypes.Line:
                    this.DrawLineChart();
                    break;

                case ChartTypes.Pie:
                    if (this.Dimension != ChartDimensions.Chart2D)
                    {
                        this.DrawPieChart3D();
                        break;
                    }
                    this.DrawPieChart();
                    break;

                case ChartTypes.Stack:
                    this.DrawStackChart();
                    break;

                case ChartTypes.HBar:
                    this.DrawHBarChart();
                    break;

                default:
                    this.DrawPieChart();
                    break;
            }
            int num = (int.Parse(this.Width.ToString().Substring(0, this.Width.ToString().Length - 2)) + this.InflateRight) + this.InflateLeft;
            int num2 = (int.Parse(this.Height.ToString().Substring(0, this.Height.ToString().Length - 2)) + this.InflateBottom) + this.InflateTop;
            if (base.DesignMode)
            {
                writer.Write("<img src='" + this.ChartFileName + "' widith='" + num.ToString() + "px' height='" + num2.ToString() + "px'/>");
            }
            else
            {
                this.ClientMouseMove = "showTips('" + this.StrBarL + "|" + this.StrBarW + "|" + this.StrBarT + "|" + this.StrBarH + "|" + this.StrBarV + "')";
                writer.Write("<script language=\"javascript\" src=\"" + this.ImageFolder + "/Chartlet.js\"></script>\r\n");
                writer.Write(string.Concat(new object[] { 
                    "<img usemap=\"#", this.ClientUseMap, "\" id=\"", this.ID, "\" border='", this.ImageBorder, "' style=\"", this.ImageStyle, "\" longdesc=\"", this.ChartTitle.Text, "\" alt=\"", this.ChartTitle.Text, "\" onclick=\"", this.ClientClick, "\" onmouseover=\"", this.ClientMouseOver, 
                    "\" onmouseout=\"", this.ClientMouseOut, "\" onmousemove=\"", this.ClientMouseMove, "\" src='", this.ImageFolder, "/", this.ChartFileName, "?", DateTime.Now.ToFileTimeUtc().ToString(), "' widith='", num.ToString(), "px' height='", num2.ToString(), "px'/>"
                 }));
            }
        }

        private void SaveChart(string path, Bitmap chart)
        {
            if (!Directory.Exists(path + this.ImageFolder))
            {
                Directory.CreateDirectory(path + this.ImageFolder);
            }
            path = path + this.ImageFolder + @"\";
            string str = string.Concat(new object[] { "FanG_Chartlet_", this.ID, ".", this.OutputFormat });
            string filename = path + str;
            chart.Save(filename, this.OutputFormat);
            if (base.Site != null)
            {
                this.ChartFileName = filename;
            }
            else
            {
                this.ChartFileName = str;
            }
            if (!Directory.Exists(path + "Chartlet.js"))
            {
                string str3 = "/*********************************************************\r\n";
                str3 = (((((((((((((str3 + "*\tChartlet Script Document generated by Chartlet.dll\r\n") + "*\tUsed for dynamic tooltip display\r\n" + "*\tPlease view http://www.chartlet.cn for more information\r\n") + "*\tFanG Corp. 2009\r\n" + "*********************************************************/\r\n") + "/* The global variables below can be used by any other js function you defined*/ \r\n" + "var left,width,top,height,value;\r\n") + "/* The function is for value show in Tooltip*/\r\n " + "function showTips(args){\r\n") + "var img=event.srcElement;\r\n" + "var ox=event.offsetX;\r\n") + "var oy=event.offsetY;\r\n" + "var argsGroup=args.split(\"|\");\r\n") + "left=argsGroup[0].split(\",\");\r\n" + "width=argsGroup[1].split(\",\");\r\n") + "top=argsGroup[2].split(\",\");\r\n" + "height=argsGroup[3].split(\",\");\r\n") + "value=argsGroup[4].split(\",\");\r\n" + "var nowAlt=img.longDesc;\r\n") + "for(i=0;i<left.length;i++){\r\n" + "if(ox>parseInt(left[i]) && ox<parseInt(left[i])+parseInt(width[i])){\r\n") + "if(oy>parseInt(top[i]) && oy<parseInt(top[i])+parseInt(height[i])){\r\n" + "nowAlt=\tvalue[i];\r\n") + "break;\r\n" + "}}}\r\n") + "img.alt=nowAlt;\r\n" + "}\r\n";
                FileStream stream = new FileStream(path + "Chartlet.js", FileMode.Create);
                StreamWriter writer = new StreamWriter(stream);
                writer.Write(str3);
                writer.Close();
                writer.Dispose();
                stream.Dispose();
            }
        }

        private void SetAppearance()
        {
            string[] strArray = this.AppearanceStyle.ToString().Split(new char[] { '_' });
            string str = strArray[0];
            if (str != null)
            {
                if (!(str == "Bar"))
                {
                    if (str == "Line")
                    {
                        this.ChartType = ChartTypes.Line;
                        this.Depth3D = 20;
                    }
                    else if (str == "Pie")
                    {
                        this.ChartType = ChartTypes.Pie;
                        this.Stroke.Color1 = Color.White;
                    }
                    else if (str == "Stack")
                    {
                        this.ChartType = ChartTypes.Stack;
                    }
                    else if (str == "HBar")
                    {
                        this.ChartType = ChartTypes.HBar;
                    }
                }
                else
                {
                    this.ChartType = ChartTypes.Bar;
                }
            }
            string str2 = strArray[1];
            if (str2 != null)
            {
                if (!(str2 == "2D"))
                {
                    if (str2 == "3D")
                    {
                        this.Dimension = ChartDimensions.Chart3D;
                    }
                }
                else
                {
                    this.Dimension = ChartDimensions.Chart2D;
                }
            }
            string str3 = strArray[2];
            if (str3 != null)
            {
                if (!(str3 == "Breeze"))
                {
                    if (str3 == "Aurora")
                    {
                        if (this.ChartType != ChartTypes.Line)
                        {
                            this.Fill.ColorStyle = ColorStyles.Aurora;
                            this.Aurora.CopyTo(this.BarBrushColor, 0);
                        }
                        else
                        {
                            this.Stroke.ColorStyle = ColorStyles.Aurora;
                            this.Aurora.CopyTo(this.BarPenColor, 0);
                        }
                    }
                    else if (str3 == "StarryNight")
                    {
                        if (this.ChartType != ChartTypes.Line)
                        {
                            this.StarryNight.CopyTo(this.BarBrushColor, 0);
                            this.Fill.ColorStyle = ColorStyles.StarryNight;
                        }
                        else
                        {
                            this.Stroke.ColorStyle = ColorStyles.StarryNight;
                            this.StarryNight.CopyTo(this.BarPenColor, 0);
                        }
                    }
                }
                else if (this.ChartType != ChartTypes.Line)
                {
                    this.Fill.ColorStyle = ColorStyles.Breeze;
                    this.Breeze.CopyTo(this.BarBrushColor, 0);
                }
                else
                {
                    this.Stroke.ColorStyle = ColorStyles.Breeze;
                    this.Breeze.CopyTo(this.BarPenColor, 0);
                }
            }
            switch (strArray[3])
            {
                case "NoCrystal":
                    this.Crystal.Enable = false;
                    if (this.ChartType == ChartTypes.Pie)
                    {
                        this.Stroke.Width = 3;
                    }
                    if (this.Dimension == ChartDimensions.Chart3D)
                    {
                        this.Alpha3D = 160;
                    }
                    goto Label_04B2;

                case "FlatCrystal":
                    this.Crystal.Enable = true;
                    this.Crystal.CoverFull = true;
                    this.Crystal.Direction = Direction.TopBottom;
                    switch (this.Fill.ColorStyle)
                    {
                        case ColorStyles.Breeze:
                            this.Crystal.Contraction = 1;
                            break;

                        case ColorStyles.Aurora:
                            this.Crystal.Contraction = 1;
                            break;

                        case ColorStyles.StarryNight:
                            this.Crystal.Contraction = 3;
                            break;
                    }
                    break;

                case "GlassCrystal":
                    this.Crystal.Enable = true;
                    this.Crystal.CoverFull = false;
                    this.Crystal.Direction = Direction.LeftRight;
                    if (this.Fill.ColorStyle != ColorStyles.Aurora)
                    {
                        this.RoundRectangle = true;
                    }
                    else
                    {
                        this.RoundRectangle = false;
                    }
                    this.RoundRadius = 3;
                    for (int i = 0; i < this.GroupSize; i++)
                    {
                        this.BarPenColor[i % 12] = ColorTranslator.FromHtml("");
                    }
                    if (this.ChartType == ChartTypes.Pie)
                    {
                        this.Stroke.Width = 0;
                    }
                    goto Label_04B2;

                case "ThickRound":
                    this.Stroke.Width = 8;
                    this.LineConnectionRadius = 0x12;
                    this.LineConnectionType = LineConnectionTypes.Round;
                    goto Label_04B2;

                case "ThickSquare":
                    this.Stroke.Width = 8;
                    this.LineConnectionRadius = 0x12;
                    this.LineConnectionType = LineConnectionTypes.Square;
                    goto Label_04B2;

                case "ThinRound":
                    this.Stroke.Width = 2;
                    this.LineConnectionRadius = 8;
                    this.LineConnectionType = LineConnectionTypes.Round;
                    goto Label_04B2;

                case "ThinSquare":
                    this.Stroke.Width = 2;
                    this.LineConnectionRadius = 8;
                    this.LineConnectionType = LineConnectionTypes.Square;
                    goto Label_04B2;

                default:
                    goto Label_04B2;
            }
            if (this.ChartType == ChartTypes.Pie)
            {
                this.Stroke.Width = 0;
            }
            if (this.Dimension == ChartDimensions.Chart3D)
            {
                this.Alpha3D = 200;
                this.Crystal.Direction = Direction.BottomTop;
                this.Crystal.Contraction = 1;
            }
        Label_04B2:
            if ((this.ChartType == ChartTypes.Line) && (this.Dimension == ChartDimensions.Chart3D))
            {
                this.Stroke.Width = 1;
                this.Alpha3D = 100;
                if (strArray[3].IndexOf("NoCrystal") > -1)
                {
                    this.Crystal.Enable = false;
                }
                if (strArray[3].IndexOf("FlatCrystal") > -1)
                {
                    this.Crystal.Enable = true;
                    this.Crystal.CoverFull = true;
                    this.Crystal.Direction = Direction.LeftRight;
                }
                if (strArray[3].IndexOf("GlassCrystal") > -1)
                {
                    this.Crystal.Enable = true;
                    this.Crystal.CoverFull = true;
                    this.Crystal.Direction = Direction.TopBottom;
                }
                if (strArray[3].IndexOf("None") > -1)
                {
                    this.LineConnectionType = LineConnectionTypes.None;
                    this.LineConnectionRadius = 0;
                }
                if (strArray[3].IndexOf("Round") > -1)
                {
                    this.LineConnectionType = LineConnectionTypes.Round;
                    this.LineConnectionRadius = 6;
                    this.Stroke.Width = 2;
                }
                if (strArray[3].IndexOf("Square") > -1)
                {
                    this.LineConnectionType = LineConnectionTypes.Square;
                    this.LineConnectionRadius = 10;
                }
            }
            string str5 = strArray[4];
            if (str5 != null)
            {
                if (!(str5 == "NoGlow"))
                {
                    if (str5 == "Glow")
                    {
                        this.Shadow.Enable = true;
                        switch (this.ChartType)
                        {
                            case ChartTypes.Bar:
                                if (this.Fill.ColorStyle != ColorStyles.StarryNight)
                                {
                                    this.Shadow.Radius = 3;
                                }
                                else
                                {
                                    this.Shadow.Radius = 5;
                                }
                                goto Label_0696;

                            case ChartTypes.Line:
                                if (!strArray[3].Contains("Thin"))
                                {
                                    this.Shadow.Radius = 6;
                                    this.Shadow.Distance = 4;
                                }
                                else
                                {
                                    this.Shadow.Radius = 2;
                                    this.Shadow.Distance = 2;
                                }
                                goto Label_0696;
                        }
                    }
                }
                else
                {
                    this.Shadow.Enable = false;
                }
            }
        Label_0696:
            if ((strArray[5] != "NoBorder") && (strArray[5] != "None"))
            {
                for (int j = 0; j < 12; j++)
                {
                    this.BarPenColor[j % 12] = Color.White;
                }
            }
            string str6 = strArray[5];
            if (str6 != null)
            {
                if (!(str6 == "NoBorder"))
                {
                    if (!(str6 == "WhiteBorder"))
                    {
                        if (str6 == "TextureBorder")
                        {
                            if (this.ChartType != ChartTypes.Bar)
                            {
                                return;
                            }
                            this.Stroke.Width = 4;
                            this.Crystal.Contraction = 0;
                            this.Shadow.Radius = 5;
                            this.RoundRectangle = false;
                            this.Shadow.Alpha = 0xff;
                            this.Stroke.TextureEnable = true;
                        }
                        return;
                    }
                }
                else
                {
                    if (this.ChartType != ChartTypes.Line)
                    {
                        this.Stroke.Width = 0;
                    }
                    if ((this.ChartType == ChartTypes.Bar) && (this.Dimension == ChartDimensions.Chart3D))
                    {
                        this.Stroke.Width = 1;
                        this.Stroke.ColorStyle = this.Fill.ColorStyle;
                    }
                    return;
                }
                switch (this.ChartType)
                {
                    case ChartTypes.Bar:
                        if (this.Dimension != ChartDimensions.Chart2D)
                        {
                            this.Stroke.Width = 1;
                            this.Crystal.Contraction = 3;
                            break;
                        }
                        this.Stroke.Width = 4;
                        this.Crystal.Contraction = 3;
                        this.Shadow.Radius = 6;
                        this.RoundRectangle = true;
                        break;

                    case ChartTypes.Pie:
                        this.Stroke.Width = 6;
                        this.Shadow.Radius = 10;
                        break;
                }
                this.Shadow.Alpha = 0xff;
            }
        }

        private void ShiftColor(int ShiftSteps, string FillorStroke)
        {
            Color[] barBrushColor = new Color[12];
            if (FillorStroke == "Fill")
            {
                barBrushColor = this.BarBrushColor;
            }
            else if (FillorStroke == "Stroke")
            {
                barBrushColor = this.BarPenColor;
            }
            ShiftSteps = ShiftSteps % 12;
            for (int i = 0; i < ShiftSteps; i++)
            {
                Color color = barBrushColor[0];
                for (int j = 0; j < (barBrushColor.Length - 1); j++)
                {
                    barBrushColor[j] = barBrushColor[j + 1];
                }
                barBrushColor[barBrushColor.Length - 1] = color;
            }
        }

        [Description("Color alpha of 3D Chart.\n3D 图形的透明度"), Category("Chartlet")]
        public byte Alpha3D
        {
            get
            {
                return this._Alpha3D;
            }
            set
            {
                this._Alpha3D = value;
            }
        }

        [Description("Chart appearance style\n图表的外观样式(你只需设置这一个属性再调用BindChartData()方法，一切OK了)"), Category("Chartlet")]
        public AppearanceStyles AppearanceStyle
        {
            get
            {
                return this._AppearanceStyle;
            }
            set
            {
                this._AppearanceStyle = value;
                this.SetAppearance();
            }
        }

        [Description("Auto calculate bar width.\n3D 自动计算柱子宽度，如果数据很少请设为false,否则柱子会很宽"), Category("Chartlet")]
        public bool AutoBarWidth
        {
            get
            {
                return this._AutoBarWidth;
            }
            set
            {
                this._AutoBarWidth = value;
            }
        }

        [PersistenceMode(PersistenceMode.Attribute), Category("Chartlet"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), Description("Background Attributes\n图形背景属性集合")]
        public BackgroundAttributes Background
        {
            get
            {
                if (this._Background == null)
                {
                    this._Background = new BackgroundAttributes();
                }
                return this._Background;
            }
            set
            {
                this._Background = value;
            }
        }

        [Category("Chartlet"), Description("Set a baseline for chart, if value is less than baseline the bar will grouth under X axies.\n设定基线值，如果数值小于基线，则图形向着Y负方向增长")]
        public double BaseLineX
        {
            get
            {
                return this._BaseLineX;
            }
            set
            {
                this._BaseLineX = value;
            }
        }

        [Category("Chartlet"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), Description("Chart title\n图表标题属性集合"), PersistenceMode(PersistenceMode.Attribute)]
        public TextAttributes ChartTitle
        {
            get
            {
                if (this._ChartTitle == null)
                {
                    this._ChartTitle = new TextAttributes();
                }
                return this._ChartTitle;
            }
            set
            {
                this._ChartTitle = value;
            }
        }

        [Description("Chart Type\n统计图的类型(如 折线图:Line)"), Category("Chartlet")]
        public ChartTypes ChartType
        {
            get
            {
                return this._ChartType;
            }
            set
            {
                this._ChartType = value;
            }
        }

        [Category("Chartlet"), Description("Output Image OnClick attribute,this event entrance attribute can provide you a interface to develop some interactive functions.\n输出图片的OnClick属性,可以为javascript代码或者js函数,这几个事件属性可以用来自定义客户端交互功能")]
        public string ClientClick
        {
            get
            {
                return this._ClientClick;
            }
            set
            {
                this._ClientClick = value;
            }
        }

        [Description("Output Image OnMouseMove attribute.\n输出图片的OnMouseMove属性,可以为javascript代码或者js函数"), Category("Chartlet")]
        public string ClientMouseMove
        {
            get
            {
                return this._ClientMouseMove;
            }
            set
            {
                this._ClientMouseMove = value;
            }
        }

        [Category("Chartlet"), Description("Output Image OnMouseOut attribute.\n输出图片的OnMouseOut属性,可以为javascript代码或者js函数")]
        public string ClientMouseOut
        {
            get
            {
                return this._ClientMouseOut;
            }
            set
            {
                this._ClientMouseOut = value;
            }
        }

        [Description("Output Image OnMouseOver attribute.\n输出图片的OnMouseOver属性,可以为javascript代码或者js函数"), Category("Chartlet")]
        public string ClientMouseOver
        {
            get
            {
                return this._ClientMouseOver;
            }
            set
            {
                this._ClientMouseOver = value;
            }
        }

        [Description("Map id on the image that you defined.\n自定义图片热点的id(如Map)"), Category("Chartlet")]
        public string ClientUseMap
        {
            get
            {
                return this._ClientUseMap;
            }
            set
            {
                this._ClientUseMap = value;
            }
        }

        [Category("Chartlet"), Description("Use different colors on 1 group data.\n 只有一组数据的时候，是否使用多种颜色")]
        public bool Colorful
        {
            get
            {
                return this._Colorful;
            }
            set
            {
                this._Colorful = value;
            }
        }

        [PersistenceMode(PersistenceMode.Attribute), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), Description("Color Guider Attributes\n颜色图例的属性集合"), Category("Chartlet")]
        public Attributes ColorGuider
        {
            get
            {
                if (this._ColorGuider == null)
                {
                    this._ColorGuider = new Attributes();
                }
                return this._ColorGuider;
            }
            set
            {
                this._ColorGuider = value;
            }
        }

        [Category("Chartlet"), Description("Show Chartlet.cn on Chart.\n3D 在图形上显示Chartlet.cn")]
        public string CopyrightText
        {
            get
            {
                return this._CopyrightText;
            }
            set
            {
                this._CopyrightText = value;
            }
        }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content), PersistenceMode(PersistenceMode.Attribute), Category("Chartlet"), Description("Crystal Attributes\n水晶效果属性集合")]
        public CrystalAttributes Crystal
        {
            get
            {
                if (this._Crystal == null)
                {
                    this._Crystal = new CrystalAttributes();
                }
                return this._Crystal;
            }
            set
            {
                this._Crystal = value;
            }
        }

        [Description("Depth of 3D effect.\n3D 效果的纵向深度"), Category("Chartlet")]
        public int Depth3D
        {
            get
            {
                return this._Depth3D;
            }
            set
            {
                this._Depth3D = value;
            }
        }

        [Description("Dimension of the chart.\n图形维数2D/3D"), Category("Chartlet")]
        public ChartDimensions Dimension
        {
            get
            {
                return this._Dimension;
            }
            set
            {
                this._Dimension = value;
            }
        }

        [Description("Fill Style\n填充属性集合"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), PersistenceMode(PersistenceMode.Attribute), Category("Chartlet")]
        public Painting Fill
        {
            get
            {
                if (this._Fill == null)
                {
                    this._Fill = new Painting();
                }
                return this._Fill;
            }
            set
            {
                this._Fill = value;
            }
        }

        [Category("Chartlet"), Description("Count of Bars in Bar-Chart of one Element\n柱状图中每个元素包含的柱子的数量")]
        public int GroupSize
        {
            get
            {
                return this._MutipleBars;
            }
            set
            {
                this._MutipleBars = value;
            }
        }

        [Description("Output Image border.\n输出图片的边框"), Category("Chartlet")]
        public int ImageBorder
        {
            get
            {
                return this._ImageBorder;
            }
            set
            {
                this._ImageBorder = value;
            }
        }

        [Category("Chartlet"), Description("Folder for saving chart image\n图片存储文件夹")]
        public string ImageFolder
        {
            get
            {
                return this._ImageFolder;
            }
            set
            {
                this._ImageFolder = value;
            }
        }

        [Description("Output Image CSS Style.\n输出图片的CSS Style属性"), Category("Chartlet")]
        public string ImageStyle
        {
            get
            {
                return this._ImageStyle;
            }
            set
            {
                this._ImageStyle = value;
            }
        }

        [Category("Chartlet"), Description("To enlarge height of background and keep the size of chart.\n增大背景高度，保持图形大小不变,可以为负数(缩小)")]
        public int InflateBottom
        {
            get
            {
                return this._InflateBottom;
            }
            set
            {
                this._InflateBottom = value;
            }
        }

        [Description("To enlarge width of background and keep the size of chart.\n增大背景宽度，保持图形大小不变,可以为负数(缩小)"), Category("Chartlet")]
        public int InflateLeft
        {
            get
            {
                return this._InflateLeft;
            }
            set
            {
                this._InflateLeft = value;
            }
        }

        [Description("To enlarge width of background and keep the size of chart.\n增大背景宽度，保持图形大小不变,可以为负数(缩小)"), Category("Chartlet")]
        public int InflateRight
        {
            get
            {
                return this._InflateRight;
            }
            set
            {
                this._InflateRight = value;
            }
        }

        [Category("Chartlet"), Description("To enlarge width of background and keep the size of chart.\n增大背景宽度，保持图形大小不变,可以为负数(缩小)")]
        public int InflateTop
        {
            get
            {
                return this._InflateTop;
            }
            set
            {
                this._InflateTop = value;
            }
        }

        [Category("Chartlet"), Description("Line Connector Radias(Width) (For line Chart)\n线条连接点的半径(宽度)（针对 折线图）")]
        public int LineConnectionRadius
        {
            get
            {
                return this._LineConnectionRadius;
            }
            set
            {
                this._LineConnectionRadius = value;
            }
        }

        [Description("Line Connection Type (For line Chart)\n线条连接点的样式（针对 折线图）"), Category("Chartlet")]
        public LineConnectionTypes LineConnectionType
        {
            get
            {
                return this._LineConnectionType;
            }
            set
            {
                this._LineConnectionType = value;
            }
        }

        [Description("Max Value of Y Axis\n自定义纵坐标的最大值，用来统一调整柱子的高度"), Category("Chartlet")]
        public double MaxValueY
        {
            get
            {
                return this._MaxValueY;
            }
            set
            {
                if (value != 0.0)
                {
                    this._MaxValueY = value;
                }
                else
                {
                    this._MaxValueY = 0.0;
                }
            }
        }

        [Description("Min Value of Y Axis\n自定义纵坐标的最小值，用来统一调整柱子的高度"), Category("Chartlet")]
        public double MinValueY
        {
            get
            {
                return this._MinValueY;
            }
            set
            {
                this._MinValueY = value;
            }
        }

        [Category("Chartlet"), Description("Image output format.\n图片输出格式")]
        public ImageFormat OutputFormat
        {
            get
            {
                return this._OutputFormat;
            }
            set
            {
                this._OutputFormat = value;
            }
        }

        [Category("Chartlet"), Description("Chartlet image saved directory when in design mode\n设计时图片暂存路径(如 C:\\)，如果有驱动器C，那就使用默认值")]
        public string RootPath
        {
            get
            {
                return this._RootPath;
            }
            set
            {
                if ((value.Substring(value.Length - 2, 1) != @"\") && (base.Site != null))
                {
                    value = value + @"\";
                }
                this._RootPath = value;
            }
        }

        [Category("Chartlet"), Description("Round Radius(For Bar Chart)\n圆角半径（针对Bar-Chart）")]
        public int RoundRadius
        {
            get
            {
                return this._RoundRadius;
            }
            set
            {
                this._RoundRadius = value;
            }
        }

        [Category("Chartlet"), Description("Enable Round Rectangle(For Bar Chart)\n使用圆角矩形（针对Bar-Chart）")]
        public bool RoundRectangle
        {
            get
            {
                return this._RoundRectangle;
            }
            set
            {
                this._RoundRectangle = value;
            }
        }

        [Category("Chartlet"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), Description("Shadow Attributes\n投影属性集合"), PersistenceMode(PersistenceMode.Attribute)]
        public ShadowAttributes Shadow
        {
            get
            {
                if (this._Shadow == null)
                {
                    this._Shadow = new ShadowAttributes();
                }
                return this._Shadow;
            }
            set
            {
                this._Shadow = value;
            }
        }

        [Category("Chartlet"), Description("Show Chartlet.cn on Chart.\n3D 在图形上显示Chartlet.cn")]
        public bool ShowCopyright
        {
            get
            {
                return this._ShowCopyright;
            }
            set
            {
                this._ShowCopyright = value;
            }
        }

        [Description("Whether show the Error information.\n是否显示错误信息"), Category("Chartlet")]
        public bool ShowErrorInfo
        {
            get
            {
                return this._ShowErrorInfo;
            }
            set
            {
                this._ShowErrorInfo = value;
            }
        }

        [Category("Chartlet"), PersistenceMode(PersistenceMode.Attribute), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), Description("Fill Style\n填充属性集合")]
        public StrokeStyle Stroke
        {
            get
            {
                if (this._Stroke == null)
                {
                    this._Stroke = new StrokeStyle();
                }
                return this._Stroke;
            }
            set
            {
                this._Stroke = value;
            }
        }

        [Description("Attributes of value tips\n数值标签的属性集合"), PersistenceMode(PersistenceMode.Attribute), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), Category("Chartlet")]
        public Attributes Tips
        {
            get
            {
                if (this._Tips == null)
                {
                    this._Tips = new Attributes();
                }
                return this._Tips;
            }
            set
            {
                this._Tips = value;
            }
        }

        [Description("XLabels Attributes\nX坐标属性集合"), Category("Chartlet"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), PersistenceMode(PersistenceMode.Attribute)]
        public XLabelsAttributes XLabels
        {
            get
            {
                if (this._XLabels == null)
                {
                    this._XLabels = new XLabelsAttributes();
                }
                return this._XLabels;
            }
            set
            {
                this._XLabels = value;
            }
        }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Content), Category("Chartlet"), Description("YLabels Attributes\nY坐标属性集合"), PersistenceMode(PersistenceMode.Attribute)]
        public LabelsAttributes YLabels
        {
            get
            {
                if (this._YLabels == null)
                {
                    this._YLabels = new LabelsAttributes();
                }
                return this._YLabels;
            }
            set
            {
                this._YLabels = value;
            }
        }

        public enum AppearanceStyles
        {
            None_None_None_None_None_None,
            Bar_2D_Breeze_NoCrystal_NoGlow_NoBorder,
            Bar_2D_Breeze_NoCrystal_Glow_NoBorder,
            Bar_2D_Breeze_NoCrystal_Glow_WhiteBorder,
            Bar_2D_Breeze_FlatCrystal_NoGlow_NoBorder,
            Bar_2D_Breeze_FlatCrystal_Glow_NoBorder,
            Bar_2D_Breeze_FlatCrystal_Glow_WhiteBorder,
            Bar_2D_Breeze_FlatCrystal_Glow_TextureBorder,
            Bar_2D_Aurora_NoCrystal_NoGlow_NoBorder,
            Bar_2D_Aurora_NoCrystal_Glow_NoBorder,
            Bar_2D_Aurora_NoCrystal_Glow_WhiteBorder,
            Bar_2D_Aurora_FlatCrystal_NoGlow_NoBorder,
            Bar_2D_Aurora_FlatCrystal_Glow_NoBorder,
            Bar_2D_Aurora_FlatCrystal_Glow_WhiteBorder,
            Bar_2D_Aurora_FlatCrystal_Glow_TextureBorder,
            Bar_2D_Aurora_GlassCrystal_NoGlow_NoBorder,
            Bar_2D_Aurora_GlassCrystal_Glow_NoBorder,
            Bar_2D_Aurora_GlassCrystal_Glow_WhiteBorder,
            Bar_2D_StarryNight_FlatCrystal_Glow_NoBorder,
            Bar_2D_StarryNight_FlatCrystal_Glow_WhiteBorder,
            Bar_2D_StarryNight_FlatCrystal_Glow_TextureBorder,
            Bar_2D_StarryNight_GlassCrystal_NoGlow_NoBorder,
            Bar_3D_Breeze_NoCrystal_NoGlow_NoBorder,
            Bar_3D_Breeze_FlatCrystal_NoGlow_NoBorder,
            Bar_3D_Aurora_NoCrystal_NoGlow_NoBorder,
            Bar_3D_Aurora_FlatCrystal_NoGlow_NoBorder,
            Bar_3D_StarryNight_NoCrystal_NoGlow_NoBorder,
            Bar_3D_StarryNight_FlatCrystal_NoGlow_NoBorder,
            Line_2D_StarryNight_ThickRound_NoGlow_NoBorder,
            Line_2D_StarryNight_ThickRound_Glow_NoBorder,
            Line_2D_StarryNight_ThickSquare_NoGlow_NoBorder,
            Line_2D_StarryNight_ThickSquare_Glow_NoBorder,
            Line_2D_StarryNight_ThinRound_NoGlow_NoBorder,
            Line_2D_StarryNight_ThinRound_Glow_NoBorder,
            Line_2D_StarryNight_ThinSquare_NoGlow_NoBorder,
            Line_2D_StarryNight_ThinSquare_Glow_NoBorder,
            Line_3D_Breeze_NoCrystalNone_NoGlow_NoBorder,
            Line_3D_Breeze_NoCrystalRound_NoGlow_NoBorder,
            Line_3D_Breeze_NoCrystalSquare_NoGlow_NoBorder,
            Line_3D_Breeze_FlatCrystalNone_NoGlow_NoBorder,
            Line_3D_Breeze_FlatCrystalRound_NoGlow_NoBorder,
            Line_3D_Breeze_FlatCrystalSquare_NoGlow_NoBorder,
            Line_3D_Breeze_GlassCrystalNone_NoGlow_NoBorder,
            Line_3D_Breeze_GlassCrystalRound_NoGlow_NoBorder,
            Line_3D_Breeze_GlassCrystalSquare_NoGlow_NoBorder,
            Line_3D_Aurora_NoCrystalNone_NoGlow_NoBorder,
            Line_3D_Aurora_NoCrystalRound_NoGlow_NoBorder,
            Line_3D_Aurora_NoCrystalSquare_NoGlow_NoBorder,
            Line_3D_Aurora_FlatCrystalNone_NoGlow_NoBorder,
            Line_3D_Aurora_FlatCrystalRound_NoGlow_NoBorder,
            Line_3D_Aurora_FlatCrystalSquare_NoGlow_NoBorder,
            Line_3D_Aurora_GlassCrystalNone_NoGlow_NoBorder,
            Line_3D_Aurora_GlassCrystalRound_NoGlow_NoBorder,
            Line_3D_Aurora_GlassCrystalSquare_NoGlow_NoBorder,
            Line_3D_StarryNight_NoCrystalNone_NoGlow_NoBorder,
            Line_3D_StarryNight_NoCrystalRound_NoGlow_NoBorder,
            Line_3D_StarryNight_NoCrystalSquare_NoGlow_NoBorder,
            Line_3D_StarryNight_FlatCrystalNone_NoGlow_NoBorder,
            Line_3D_StarryNight_FlatCrystalRound_NoGlow_NoBorder,
            Line_3D_StarryNight_FlatCrystalSquare_NoGlow_NoBorder,
            Line_3D_StarryNight_GlassCrystalNone_NoGlow_NoBorder,
            Line_3D_StarryNight_GlassCrystalRound_NoGlow_NoBorder,
            Line_3D_StarryNight_GlassCrystalSquare_NoGlow_NoBorder,
            Pie_2D_Breeze_NoCrystal_NoGlow_NoBorder,
            Pie_2D_Breeze_NoCrystal_NoGlow_WhiteBorder,
            Pie_2D_Breeze_NoCrystal_Glow_WhiteBorder,
            Pie_2D_Breeze_FlatCrystal_NoGlow_NoBorder,
            Pie_2D_Breeze_FlatCrystal_Glow_WhiteBorder,
            Pie_2D_Breeze_GlassCrystal_NoGlow_NoBorder,
            Pie_2D_Breeze_GlassCrystal_Glow_WhiteBorder,
            Pie_2D_Aurora_NoCrystal_NoGlow_NoBorder,
            Pie_2D_Aurora_NoCrystal_NoGlow_WhiteBorder,
            Pie_2D_Aurora_NoCrystal_Glow_WhiteBorder,
            Pie_2D_Aurora_FlatCrystal_NoGlow_NoBorder,
            Pie_2D_Aurora_FlatCrystal_Glow_WhiteBorder,
            Pie_2D_Aurora_GlassCrystal_NoGlow_NoBorder,
            Pie_2D_Aurora_GlassCrystal_Glow_WhiteBorder,
            Pie_2D_StarryNight_NoCrystal_NoGlow_NoBorder,
            Pie_2D_StarryNight_NoCrystal_NoGlow_WhiteBorder,
            Pie_2D_StarryNight_NoCrystal_Glow_WhiteBorder,
            Pie_2D_StarryNight_FlatCrystal_NoGlow_NoBorder,
            Pie_2D_StarryNight_FlatCrystal_Glow_WhiteBorder,
            Pie_2D_StarryNight_GlassCrystal_NoGlow_NoBorder,
            Pie_2D_StarryNight_GlassCrystal_Glow_WhiteBorder,
            Pie_3D_Aurora_NoCrystal_NoGlow_NoBorder,
            Pie_3D_Aurora_FlatCrystal_NoGlow_NoBorder,
            Pie_3D_Breeze_NoCrystal_NoGlow_NoBorder,
            Pie_3D_Breeze_FlatCrystal_NoGlow_NoBorder,
            Pie_3D_StarryNight_NoCrystal_NoGlow_NoBorder,
            Pie_3D_StarryNight_FlatCrystal_NoGlow_NoBorder,
            Stack_2D_Breeze_NoCrystal_NoGlow_NoBorder,
            Stack_2D_Breeze_NoCrystal_Glow_NoBorder,
            Stack_2D_Breeze_NoCrystal_Glow_WhiteBorder,
            Stack_2D_Breeze_FlatCrystal_NoGlow_NoBorder,
            Stack_2D_Breeze_FlatCrystal_Glow_NoBorder,
            Stack_2D_Breeze_FlatCrystal_Glow_WhiteBorder,
            Stack_2D_Breeze_FlatCrystal_Glow_TextureBorder,
            Stack_2D_Aurora_NoCrystal_Glow_WhiteBorder,
            Stack_2D_Aurora_FlatCrystal_NoGlow_NoBorder,
            Stack_2D_Aurora_FlatCrystal_Glow_NoBorder,
            Stack_2D_Aurora_FlatCrystal_Glow_WhiteBorder,
            Stack_2D_Aurora_FlatCrystal_Glow_TextureBorder,
            Stack_2D_Aurora_GlassCrystal_NoGlow_NoBorder,
            Stack_2D_Aurora_GlassCrystal_Glow_NoBorder,
            Stack_2D_Aurora_GlassCrystal_Glow_WhiteBorder,
            Stack_2D_StarryNight_FlatCrystal_Glow_NoBorder,
            Stack_2D_StarryNight_FlatCrystal_Glow_WhiteBorder,
            Stack_2D_StarryNight_FlatCrystal_Glow_TextureBorder,
            Stack_2D_StarryNight_GlassCrystal_NoGlow_NoBorder,
            Stack_3D_Breeze_NoCrystal_NoGlow_NoBorder,
            Stack_3D_Breeze_FlatCrystal_NoGlow_NoBorder,
            Stack_3D_Aurora_NoCrystal_NoGlow_NoBorder,
            Stack_3D_Aurora_FlatCrystal_NoGlow_NoBorder,
            Stack_3D_StarryNight_NoCrystal_NoGlow_NoBorder,
            Stack_3D_StarryNight_FlatCrystal_NoGlow_NoBorder,
            HBar_2D_Breeze_NoCrystal_NoGlow_NoBorder,
            HBar_2D_Breeze_NoCrystal_Glow_NoBorder,
            HBar_2D_Breeze_NoCrystal_Glow_WhiteBorder,
            HBar_2D_Breeze_FlatCrystal_NoGlow_NoBorder,
            HBar_2D_Breeze_FlatCrystal_Glow_NoBorder,
            HBar_2D_Breeze_FlatCrystal_Glow_WhiteBorder,
            HBar_2D_Breeze_FlatCrystal_Glow_TextureBorder,
            HBar_2D_Aurora_NoCrystal_NoGlow_NoBorder,
            HBar_2D_Aurora_NoCrystal_Glow_NoBorder,
            HBar_2D_Aurora_NoCrystal_Glow_WhiteBorder,
            HBar_2D_Aurora_FlatCrystal_NoGlow_NoBorder,
            HBar_2D_Aurora_FlatCrystal_Glow_NoBorder,
            HBar_2D_Aurora_FlatCrystal_Glow_WhiteBorder,
            HBar_2D_Aurora_FlatCrystal_Glow_TextureBorder,
            HBar_2D_Aurora_GlassCrystal_NoGlow_NoBorder,
            HBar_2D_Aurora_GlassCrystal_Glow_NoBorder,
            HBar_2D_Aurora_GlassCrystal_Glow_WhiteBorder,
            HBar_2D_StarryNight_FlatCrystal_Glow_NoBorder,
            HBar_2D_StarryNight_FlatCrystal_Glow_WhiteBorder,
            HBar_2D_StarryNight_FlatCrystal_Glow_TextureBorder,
            HBar_2D_StarryNight_GlassCrystal_NoGlow_NoBorder
        }

        public enum ChartDimensions
        {
            Chart2D,
            Chart3D
        }

        public enum ChartTypes
        {
            Bar,
            Line,
            Pie,
            Stack,
            HBar,
            Bubble,
            Histogram
        }

        public enum ColorStyles
        {
            None,
            Breeze,
            Aurora,
            StarryNight
        }

        public enum Direction
        {
            LeftRight,
            TopBottom,
            RightLeft,
            BottomTop
        }

        public enum LineConnectionTypes
        {
            Round,
            Square,
            None
        }
    }
}

